John
John

Reputation: 7880

Js : open new window and work with it

is possible to open new window ( with external url ) with javascript or jquery and check if in that window was submited a form

something like : window.open(....) then : if ( POST in new window ) { document.write('in new window was submited a form ' ); } ..

Thanks in advance

Upvotes: 0

Views: 267

Answers (2)

Shadow Wizard
Shadow Wizard

Reputation: 66399

You can open the window using such code:

<script type="text/javascript">
var oWindow = 0;
function OpenWin(sURL) {
    oWindow = window.open(sURL, "_blank");
}
</script>

This will open the window and save reference in global variable.

If the new page is in your own domain and the form submits to different page, you can check the oWindow.location.href in timer e.g. every half a second, and if the location match the form action you can assume it was submitted.

If the new page is in your domain you can also hook into the form onsubmit, using jQuery is the most simple way - can you use it?

Upvotes: 0

Alex Bagnolini
Alex Bagnolini

Reputation: 22382

If you are guaranteed to have javascript available, you might try a modal popup within the same page.

You tagged your question jQuery so you might want to look at some jQuery popup modal dialogs plugins.

Being in the same page, you can control wether the form has been submitted or not.

Upvotes: 1

Related Questions