I was able to display a dialog when clicking on a link. How do I the pull another page's contents while in the dialog?
I am not sure how to get a reference on the dialog window to make it load different content without closing and reopening.
2009-04-17 19:03:49
PS: I just tried load, that did not work.
2009-04-17 19:09:11
Try something like $('#theDialog').load('someOtherFile.html'); Then when you click the link, it will have the contents of the remote file. There are various ways of loading the file, but this is the most straight forward.
Jab
2009-04-17 20:14:32
A:
When you call a file via jquery's i.e. load-method, then it it is possible to load further content from the loaded file when it is dropped into the window dialog:
<script>
$(document).ready(function(){
$("#myDropZone").load("another-file.html");
});
</script>
This code has to be returned from the loaded html content.
BTM, you can load content in different ways, but be aware of what you are doing. Do not load files recursively. Would be the same as a loop.
Hope this helps
Tom Schaefer
2009-04-18 16:04:47
Should the above function reside in the html of the original page or dialog? I dont't understand which page responds to events inside the dialog, is it the dialog itself, or the page that invokes it?
2009-04-22 14:40:13
Sorry, if I had not written clearly. I do mean the page, which is being invoked by your first request (not the dialog).
Tom Schaefer
2009-04-23 16:58:46
+1
A:
I've done this in the past by loading the 'other content' into a div and then displaying that div as a dialog.
$('#dialog').load('other_content.html', function(){
$(this).dialog();
}
jQuery Docs for Ajax/load
Jon Dowdle
2009-04-23 12:08:50