Jquery not working in IE

This Comment will be submitted for moderation and will not be accessible to other users until it has been approved.


24 points

Hi,

I have the following function in Jquery. The function will check if there are any new posts to the message board, and if so, will load them. For some reason, new data never loads in IE 7, but loads fine in FF and Chrome. Moreover, when I refresh the page, the data doesn't come in either - only when the cache is cleared.

 function update(){
    $.get("getlatest.php", {
        id: $.cookie('last_post_id')
    }, function(response){
 
 
        $('#board_posts').prepend(response);
        $('.incoming_post').slideDown("slow").effect("highlight", {}, 3000);
        $('.incoming_post').toggleClass("incoming_post").addClass("old_post");
 
    }, "html");
}



16 points

Internet Explorer caches requests. See the cache flag for jQuery Ajax requests. It will add a random query string parameter to the URL (based on the current time) to make it unique and uncacheable. You can do this yourself as well if you like: 'request.php?_=' + (+new Date())

Anonymous's picture
Created by Anonymous
8 points

The solution: http://eisabainyo.net/weblog/2010/04/21/troubleshooting-jquery-get-cache-issue-in-internet-explorer/

Anonymous's picture
Created by Anonymous

Post Comment

  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.