As following, suppose I have a click button in A.html to open a ui dialog,
and the dialog will load the B.html as content.
So, if I want to get the value which id=inputName in B.html after the user click the button “ok” on the dialog, how can I do? I always get “undefined”.
Sorry that maybe a stupid problem becase I’m new to jQuery.
I will very apreciate if you can help me.
A.html
$(function(){
$('#name').click(function(){
var aaa = window.parent.$.dialog({
buttons: {
'ok': function(){
//get the value from B.html(ex.the value which id=inputName)
$aaa.dialog('close');
}
}
});
var link = 'B.html';
aaa.load(link);
aaa.dialog('open')
});
}); //jquery code
<div>
<input type="button" value="input your name" id='name'>
</div> //html code
B.html
<input type="text" name="inputName" id="inputName"/>
Actually, I would like to get the value in B.html for the purpose of CGI by ajax request.
In another way, I done this work adding following code to B.html: