开发者

Displaying success/failure messages from hidden iframe submit

I'm using the hidden iframe method to submit a for开发者_如何转开发m with a file upload field. I want to display a message back on the page using javascript and I'm not sure how to do this. If this was just a form with text fields I'd do an AJAX post and respond with a message I'd display in my callback function. I'm just not sure how to accomplish this same task with the hidden iframe method since it is a standard form post.


Inside the iframe, when your server responds after finishing the upload, you can include some onload Javascript in there that references the parent frame.

Alternatively, you could attach an onload listener to the iframe itself from within the parent page. If you add this listener after the iframe initially loads, it should not fire until the next load (which would be after the upload completes).


Enclose your iframe HTML in <div onload="javascript:window.parent.your_handler();"> ... </div>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜