Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/405.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript ajax请求在IE上不起作用_Javascript_Jquery_Internet Explorer - Fatal编程技术网

Javascript ajax请求在IE上不起作用

Javascript ajax请求在IE上不起作用,javascript,jquery,internet-explorer,Javascript,Jquery,Internet Explorer,这段代码在Mozilla和chrome上运行正常,但在IE上运行不正常。IE上没有启动Ajax调用。原因可能是什么。通过执行以下操作关闭缓存: function VReload() { $.ajax({ type: "GET", url: "/foo/", success: function (data) { $("#myid").html(data); } }); } $(docume

这段代码在Mozilla和chrome上运行正常,但在IE上运行不正常。IE上没有启动Ajax调用。原因可能是什么。

通过执行以下操作关闭缓存:

function VReload()
{
     $.ajax({
         type: "GET",
         url: "/foo/",
         success: function (data) {
        $("#myid").html(data);
        }
     });
 }
 $(document).ready(function() { 
setInterval('VReload()', 1000)
});

使用jQuery的$.get函数

$.ajax({
         type: "GET",
         cache: false,
         url: "/foo/",
         success: function (data) {
        $("#myid").html(data);
        }
     });
试试这个:

$.get('/foo/', {}, function(data){
 // whatever
});
将缓存设置为false


您100%确定根本没有触发的是Ajax调用,而不是像Ajax错误这样的其他调用?什么不起作用?错误是什么?你有控制台的追踪吗?Firebug对此有何评论?向您证明代码流的警报调用在哪里?到目前为止,您还进行了哪些调试?永远不要将字符串作为setInterval的第一个参数传递!在您的情况下,只需传递VReload-如果您需要带参数的内容,请在此处使用函数{/*您的代码*/}这是简化代码的好方法,但它不是问题的答案
function VReload()
{
     var timestamp = new Date();
     $.ajax({
         type: "GET",
         url: "/foo/" + "&timestamp=" + timestamp.getTime(),
         success: function (data) {
        $("#myid").html(data);
        }
     });
 }
 $(document).ready(function() { 
setInterval('VReload()', 1000)
});
$.ajaxSetup({   cache: false    });
$.ajax({
         cache: false,
         //other options

     });