I want to refresh a <div>
on the close of a jQuery UI Modal Dialog.
My code is:
var dialog = jQuery('#divPopup').dialog({
autoOpen: false,
height: 450,
width: 650,
modal: true,
open: function(event, ui) {
jQuery('body').css('overflow', 'hidden');
},
close: function(event, ui) {
jQuery('#divPopup').dialog('destroy').remove();
jQuery("#bodyId").load("http://www.xyz.com/ #bodyId");
}
});
But instead of replacing it, that adds the new <div>
inside the old <div>
:
<div id="bodyId">
<div id="bodyId">
New Response
</div>
</div>
I want to replace old div bodyId
with new div bodyId
.
"http://www.xyz.com/#bodyId"
does not include a<div id="bodyId">
in its output? – Counterweigh#bodyId
. Have a look at.load()
docs, chapter "Loading Page Fragments". – Vaclava