Arno 2501
Arno 2501

Reputation: 9417

Strange Ajax / Jquery behaviour in Internet Explorer 9

I have an ajax call inside a javascript function that update a div with the result. This function is called every 2 seconds.

function RefreshNbrMsg() { 
   $.ajax({ 
      url: 'helper/NewMessages.aspx', 
      success: function (data) { 
         $('#nbr_msg').empty().append(data); 
      } 
   }); 
} 

$(document).ready(function () { 
   setInterval(RefreshNbrMsg, 2000); 
}); 

My problem is that it's working perfectly with Chrome but not IE. In IE the div won't update.

I don't have any script error or messages. I can see in the network analyzer that the ajax call is done every 2 seconds.

/helper/NewMessages.aspx GET 304 text/html 108 B < 1 ms JS Library XMLHttpRequest

Any ideas ?

Upvotes: 1

Views: 225

Answers (1)

Mehdi Bugnard
Mehdi Bugnard

Reputation: 3979

Try this :

    function RefreshNbrMsg() {
        $.ajax({
           cache: false,
           url: 'helper/NewMessages.aspx',
           success: function (data) 
           {
                $('#nbr_msg').empty().append(data);
           }
        });
    }


    $(document).ready(function () {
        setInterval(RefreshNbrMsg, 2000);
    });

Upvotes: 3

Related Questions