来自我的webapp的XML响应都有要添加到页面的HTML,有些还有要运行的脚本.
我正试图从我的webapp发回XML,如:
<?xml version="1.0"?>
<doc>
<html-to-insert>
<![CDATA[<p>add me to the page</p>]]>
</html-to-insert>
<script>
<![CDATA[ alert('execute me'); ]]>
</script>
</doc>
Run Code Online (Sandbox Code Playgroud)
我现在正在做的是抢购<html-to-insert>和<script>CDATA,将html插入页面并进行评估<script>.
我正在寻找对我的方法的批评.任何人的建议?