Reputation: 42808
When i click on element id #itest, I want to load a form with id #form from file modal.html into a jquery UI dialog() box. How can i do this. Should i have an empty div #result to load content in first.
Upvotes: 2
Views: 4214
Reputation: 342635
Here is a barebones example of what you are trying to do:
var $div = $("<div/>");
$("#itest").click(function() {
$div.load('modal.html #form', function() {
// apply the dialog once the div has been filled up
$div.dialog();
});
});
You can create a div on the fly or use one which exists on the page, and populate it with the form from modal.html using $.load
. To return a particular subset of a page, just put the selector after the URL (as in the above example).
Upvotes: 3