Php 不在Internet explorer中工作?
我有这个脚本,它在除internet explorer之外的所有浏览器上都运行良好。基本上,这个脚本正在刷新页面以显示聊天。有什么建议吗 如果只是在internet explorer中,我可以让它每隔一段时间刷新一次吗Php 不在Internet explorer中工作?,php,jquery,html,ajax,Php,Jquery,Html,Ajax,我有这个脚本,它在除internet explorer之外的所有浏览器上都运行良好。基本上,这个脚本正在刷新页面以显示聊天。有什么建议吗 如果只是在internet explorer中,我可以让它每隔一段时间刷新一次吗 function ajax(){ var req = new XMLHttpRequest(); req.onreadystatechange = function(){ if(req.readyState == 4 && req.status == 200
function ajax(){
var req = new XMLHttpRequest();
req.onreadystatechange = function(){
if(req.readyState == 4 && req.status == 200){
document.getElementById('chat').innerHTML = req.responseText;
}
}
req.open('GET','chat.php',true);
req.send();
}
setInterval(function(){ajax()},1000);
在旧版本的IE上,需要window.ActiveXObject()
使用Jquery而不是Javascript 像这样:
$.ajax({
url:"chat.php",
type:"get",
success:function(responseText){
document.getElementById('chat').innerHTML = responseText;
}
})
这不是答案。添加以了解有关支持的信息
XMLHttpRequest
在旧IE中不受支持
XMLHttpRequest在旧版本的IE中不可用。它在IE7+中可用。如果较低,则应使用ActiveXObject(“Microsoft.XMLHTTP”)制作有意义的标题,然后添加什么是IE版本,并将您尝试的内容和期望的内容添加到IE版本?因为我在IE 10/11中使用XMLHttpRequest,并且它可能与
$.ajax({
url:"chat.php",
type:"get",
success:function(responseText){
document.getElementById('chat').innerHTML = responseText;
}
})