I want to load a page into jQuery Dialog plugin (by using that code jQuery: Load Modal Dialog Contents via Ajax) In that page user will select some data. After the selection, when he closes the Dialog window, I need to retrieve the user's selected data from that Dialog window. How can I do that ?
Asked
Active
Viewed 684 times
1
-
1Hack : During selection in the Dialog window, write values in hidden input tags in the parent window. – TJ- Oct 07 '12 at 13:30
1 Answers
4
First thing you want to do is have the values saved when the dialog closes. Let's say this is the page you are loading:
<input type="text" id="text1" name="text1" /><br />
<input type="text" id="text2" name="text2" /><br />
<a href="#" id="dialog_submit_button">Click</a>
Then when you load the dialog, you should add this:
jQuery('#dialog').dialog({
// all you other stuff
close: function(){
var in1 = $('#text1').val();
var in2 = $('#text2').val();
jQuery.dialog_info = {
input1 : in1,
input2 : in2
}
}
});
Now, those text values can be pulled anytime you need in the rest of the code with
var value1 = jQuery.dialog_info.input1;
var value2 = jQuery.dialog_info.input2;
Hope that helps

James L.
- 4,032
- 1
- 15
- 15