我创建了一个简单的 html,其中我使用 php 和 jQuery 从 MYSQL 下载数据。它在 Chrome 中工作正常(数据每 5 秒刷新一次)但在 IE 中即使 window.setInterval
工作正常数据仅在第一次加载文档时下载一次,之后数据不下载清爽。
function myFunc(){
console.log("it works");
$(document).ready(function(){
$.getJSON("http://taxipolis.gr/phpfiles/drivers/get_alldrivers_coordinate_html.php",
function (data) {
});
});
}
window.setInterval(myFunc,5000);
我做错了什么?
最佳答案
我认为您需要为 ie 使用 XDomainRequest
。尝试使用此代码
var xdr = new XDomainRequest();
xdr.onload = function() { alert("READY"); };
xdr.open("GET", "http://taxipolis.gr/phpfiles/drivers/get_alldrivers_coordinate_html.php");
xdr.send();
检查这个 link了解更多信息
关于javascript - JQuery getJSON 在 IE 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22272628/