<div id="modal" style="display: none;">loading...</div>
<a href="#" class="ajax">click me</a>
$('.ajax').on('click', function() {
$.ajax({
url: '/',
beforeSend: function() {
$('#modal').dialog({
modal: true,
width: 100,
height: 100
});
},
success: function(data) {
$('#modal').html('new value new value new value new value new value new value new value new value new value new value new value new value new value new value new value new value ');
}
});
return false;
});
https://jsfiddle.net/wrd7xr5m/
How can I use the same dialog in success with restore width\height with new content? In real project I use this:
$('#modal').html(data)
$('#modal').dialog({ modal: true});???successthen your data is loaded in the modal and you can just use it later on with$('#modal').dialog();. The question is kinda vague.. please clarify how and where you want to use the same dialog..var modalConfig = { modal: true, width: 100, height: 100 }and usemodalConfigthat everywhere..