我有一个Ajax响应,其中包含一些HTML,包括<脚本>
元素
I have an AJAX response that contains some HTML, including <script>
elements.
这个HTML应该替换现有的元素,但是当我使用:
This HTML should replace an existing element, but when I use:
$(element).replaceWith($(response))
我失去了脚本标记从它...
I lose the script tags from it...
我如何可以将它究竟是如何发送的HTML?
How can I insert the HTML exactly how it is sent?
这code是Facebook的示例应用程序。插入&LT; DIV ID =FB-根&GT;&LT; / DIV&GT;
在文档中。在code要求jQuery来加载脚本。在你的情况下,更换 //连接..... / all.js的
与&LT;脚本&GT;
元素。
This code is from facebook's sample app. Insert <div id="fb-root"></div>
in your document. The code requires jQuery to load up the script. In your case, replace //connect...../all.js
' with the <script>
elements.
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
上一篇:我如何通过与XMLHTT prequest变量变量、XMLHTT、prequest
下一篇:包装是由allow_url_include = 0禁用服务器配置是由、服务器配置、allow_url_include