簡體   English   中英

iFrame 表單提交並在結果后發出警報

[英]iFrame form submit and alert after result

我有一個隱藏的 iFrame,其形式如下:

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

采取行動后,我得到我的表格並執行submit

MyForm.submit();

當表單完成與服務器的通信時,我需要的是“結果”(作為警報)。

我試過用這種方式寫callback ,但我不知道把它放在哪里......

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

我不能使用 jQuery、Ajax 等。

嘗試這個

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM