简体   繁体   中英

iFrame form submit and alert after result

I have a hidden iFrame with a form like this:

<form name="MyForm" id="SaveForm" target="MyFrame">
.....
</form>
<iframe name="MyFrame" height="0" width="0" style="display: none"></iframe>

After an action, i get my form and i perform a submit

MyForm.submit();

What i need is a "result" (as alert) when the form has finished the communication with the server.

I've tried to write the callback in this way, but i dont know where to put it...

function callbackQrContext() {
    window.parent.alert('finished!');
}

I cant use jQuery, Ajax and so on.

Try this

var ajx;
ajx=new XMLHttpRequest();
ajx.onreadystatechange = function() {
if (ajx.readyState == 4 && ajx.status == 200) {
  callbackQrContext(ajx);
}
ajx.open("GET", "yoururl", true);
ajx.send();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM