user12345
user12345

Reputation: 2418

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 call is not firing on IE. What could be the reason.

Upvotes: 2

Views: 2105

Answers (4)

Gowri
Gowri

Reputation: 16835

set cache false

$.ajaxSetup({   cache: false    });

or

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

     });

Upvotes: 2

alexl
alexl

Reputation: 6851

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

Upvotes: 1

Stefan
Stefan

Reputation: 4130

use jQuery's $.get() function

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

Upvotes: 0

adarshr
adarshr

Reputation: 62583

Switch off caching by doing this:

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

Upvotes: 2

Related Questions