Reputation: 359
I have created a dialog box and i want to load a HTML page into it h
Upvotes: 0
Views: 11800
Reputation: 171669
Since you said you've already created the dialog, loading and opening then become as simple as:
$('#dialog').load( url, function(){
$(this).dialog('open');
});
Upvotes: 0
Reputation: 38147
Something like this :
var url = "the url";
var dialog = $("#dialog");
if ($("#dialog").length === 0) { // only create if it doesn't exist
dialog = $('<div id="dialog"></div>').appendTo('body');
}
// load remote content
dialog.load(
url, {}, function(responseText, textStatus, XMLHttpRequest) {
dialog.dialog({
// your options
})
})
Upvotes: 0
Reputation: 13344
Assuming your dialog box is #dialog (<div id="dialog"></div>
), this would work:
$.get("url/to/yourpage.html", function(data) {
$("#dialog").html( data );
});
Upvotes: 6