I have a form with an iframe as its target, and I want to retrieve 开发者_运维技巧its contents after the form has been submitted.
The problem is if I do something like:
$('form').submit(function (e) {
e.preventDefault();
var content = $('iframe').contents();
});
I get nothing because the form only submits after this. Is there any event that I can use AFTER the iframe received its content?
Thanks.
Try using the load event of the iframe.
$("iframe").load(function(){
var response = this.document.getElementsByTagName("body").innerHTML;
alert(response);
});
精彩评论