我一直很难找到一个好的解决方案。我有一个旨在为网站提供辅助服务的子域。喜欢暗示性的销售等,我已经创建了一个代码,将提交一个阿贾克斯后跟踪。第二个Ajax调用将抓取HTML,并将其发布到一个div。这适用于IE10,Chrome,Safari和Firefox。但在IE 7-9中不起作用。跨域Ajax调用子域IE7 +
我发现很多帖子,那半解释一个解决方案。但似乎没有为我工作。有没有人有处理这方面的经验?非常感谢帮助。
// TRACKER
function log() {
$.ajax({url:"http://sub.differentdomain.com/in/li/", dataType:"html", type:"POST", cache:false, timeout:1000, data:{item:"ITEM1", session:"SESSIONKEY"}});
}
// DISPLAYER
function getTools() {
$.ajax({url:"http://sub.differentdomain.com/out/sug/", dataType:"html", type:"POST", cache:false, timeout:6000, crossDomain:true, async:false, beforeSend:function() {
$("#ccont #selling-tools").html('<div class="boxset" style="width:95%; margin:20px 2%;padding:20px 0.5%; margin-bottom:0;"><img src="loader.gif" align="center" /></div>').show();
}, error:function() {
$("#ccont #selling-tools").html("");
}, data:{item:"ITEM1", session:"KEY1"}}).done(function(html) {
$("#selling-tools").html(html);
});
}
上实现同样的结果也将做任何其他的建议...
也许这可以帮助你http://stackoverflow.com/questions/11487216/cors-with-jquery-and-xdomainrequest-in-ie8-9 – ncubica