我想提供一个可嵌入的JavaScript,它将从我的服务器获取脚本。而后者会从用户(我的可嵌入式js的页面)中获取一些细节并将其放回到我的服务器上。我如何去实现这一点。脚本标记破解+如何在AJAX的第二级之后进行通信
这是我提供的可嵌入式js。
<script>
(function() {
read="This is the data which is entered by the user";
var istreet = document.createElement('script'); istreet.type = 'text/javascript'; istreet.async = true;
istreet.src = 'http://xyz.com/a.php;
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(istreet);
})();
</script>
$('<div id="content"></div>').appendTo('body');
$('#content').html('
Some html to inject to the page\'s dom .
');
$.get("http://xyz.com/process.php?dataToProcess="+read,function(data){
alert(data);
});
代码,但我看到,$获得( “http://xyz.com/process.php?dataToProcess=” +阅读功能(数据){// 导致跨域Ajax请求
我不想解决跨域AJAX的问题。 我希望能够与嵌入脚本双方一间(通信和我的服务器)无缝地。