开发者

jQuery iframe html() null

I am making a script for a webpage of mine, where I use jquery to upload files using a hidden iframe. After the uploading is done, the PHP script, that I use for uploading, "echoes" a JSON String. To watch that string I do :

$("#myform").submit(function () {
    $("#myframe").load(function () {
        alert ($(this).contents().text());
    });
});

This works properly, but when I try to use html(), instead of text(), I get null ins开发者_如何学编程tead of the iframe's contents. Why that?


Are you sending the JSON with a text/plain MIME type? If so, why would the browser parse this as HTML? If you're sending text, don't expect to receive HTML.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜