开发者

ajax request not working on IE

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

This piece of code is working fine on Mozilla and chrome but not on IE. Ajax ca开发者_运维问答ll is not firing on IE. What could be the reason.


Switch off caching by doing this:

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


set cache false

$.ajaxSetup({   cache: false    });

or

$.ajax({
         cache: false,
         //other options

     });


Try this:

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)
});


use jQuery's $.get() function

$.get('/foo/', {}, function(data){
 // whatever
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜