我有一个iframe进行图片上传,给人一种错误的Ajax上传感.
这个iframe的内容有javascript,可以检查各种内容并发送状态.几乎将其视为进度报告.无论如何,我的包含iframe的页面是显示数据的页面,但是我想要在iframe中更改父页面上的数据.这是我的代码:
<div id="iframe_response"></div>
<iframe style="border:none" src="someurl" width="100%" height="350px" id="iframe"></iframe>
Run Code Online (Sandbox Code Playgroud)
这是我在iframe中的jQuery:
$('#iframe_response', "#iframe").append('this should go there but it\'s not...');
Run Code Online (Sandbox Code Playgroud)
但是它不会给那个div写任何东西.我已经在document.ready上调用了它,但是唉......
我究竟做错了什么?
用parent.document而不是window.parent.document
$(parent.document).find('#whatever')
Run Code Online (Sandbox Code Playgroud)