I have a dialog window that uses a URL for its开发者_开发知识库 contents
{
function(){jQuery.ajax({'success':function(html) {
jQuery('#menu_dialog').html(html);
$('#menu_dialog').dialog('open');
$('#header').hide();
},'url':'/testing/index.php/menu','cache':false});return false;};
}
What happens is that it was displaying the whole page, including the header, the footer,navigation menu,etc. What I want is for the dialog to only display the content inside the <content>
tag.
How can I remove the unnecessary divs in the dialog window?
Rather than taking your data and using it directly, get only what you need:
// you had: jQuery('#menu_dialog').html(html);
var newPage = jQuery(html);
jQuery('#menu_dialog').empty().append(newPage.find('#content'));
I think this might work
$("#menu_dialog").children().not("content").remove();
精彩评论