Reputation: 15
Im having problems with dialog box. I wanted to display inside the Dialog box the HTML content of the another page. for example.
index.php
var url = "/leave_ot/statistics.php?what="+type+"&item="+applicant;
//alert(url);
$.ajax({
type : 'GET',
url : url,
success : function(result)
{
$( "#dialog" ).dialog({
height: 140,
modal: true
});
}
})
applicant.html
some html codes
I wanted to put the html contents of applicant.html into the dialog box of index.php
Upvotes: 0
Views: 374
Reputation: 782508
Use the .html()
method to insert the HTML result into the DIV.
$.ajax({
type : 'GET',
url : url,
success : function(result)
{
$( "#dialog" ).dialog({
height: 140,
modal: true
}).html(result);
}
});
Note that this only works if the URL is in the same domain; cross-domain AJAX prevents using it for other domains. If you need that, you'll have to use an IFRAME; see the answers in How do you open a URL in a dialog box JQUERY UI
Upvotes: 2