发送“iframe.contents()“;通过Ajax转换PHP脚本有什么想法吗?


Send "iframe.contents()" to PHP Script through Ajax any ideas ?

在我的代码中,我有一个iFrame加载动态内容,它就像一个页面(a.p p)内的网页(b.p html)。在" a.p php"中,一旦编辑过程完成,用户可以内联编辑" b.h html"。在我的提交中,我将iframes信息发送到另一个页面(script.php)。我尝试了一切,但内容没有出现在"script.php"。

简而言之,我想通过AJAX将我的大html文本与所有内容传输到PHP。我不知道该怎么做……我的代码如下所示:-

" a.p php"的代码inscript:"myframe"是包含HTML大段的iframe。

sendString = $("#myframe").contents();//Tried everything here[JSON as well] 
 $.ajax({
    url: "script.php",
    type: "POST",       
    data: sendingString,    
    cache: false,
    success: function (html) { 
         return html;
    } 
});

任何帮助都会很感激。

问候,阿姆

$("#myframe").contents()将获得它的节点作为jQuery对象。尝试$("#myframe").html()以获取字符串形式的内容。

EDIT:哦,如果您修复变量名称,它也会有所帮助。修改data: sendingStringdata: sendString