How to pass value from parent to child window field. I use window.open("www.google");
after popwindow is opened i need to pass/set search value typed in parent window to child window(www.google)
How to pass value from parent to child window field. I use window.open("www.google.");
after popwindow is opened i need to pass/set search value typed in parent window to child window(www.google.)
Share Improve this question asked Apr 20, 2010 at 19:47 minilminil 7,15516 gold badges51 silver badges57 bronze badges2 Answers
Reset to default 2Set a reference using the window.open() method:
var childWin = window.open("www.google." <etc.>);
Then treat childWin as a whole other window. For example,
childWin.document.getElementById('searchField')
will give you a reference to an element with ID of "searchField". Etc. Rinse and repeat.
If you want to open a page or window with sending data POST or GET method you can use a code like this:
$.ajax({
type: "get", // or post method, your choice
url: yourFileForInclude.php, // any url in same origin
data: data, // data if you need send some data to page
success: function(msg){
console.log(msg); // for checking
window.open('about:blank').document.body.innerHTML = msg; // you can change about:blank to an url.
}
});