Search code examples
jqueryajaxasp.net-mvc-3internet-explorer-9

IE does not refresh after Ajax get/posts


I have a small problem that I don't know how to deal with.

I've written some jQuery post/gets which work fine in FF, Opera and Chrome. But when run from explorer (any version) the updated content from the request does not get loaded into the browser. I've used developer tools and debugged the scripts, and the requests are sent with correct parameters. The actions are even executed, but it's not visible until I've cleared the browser history or open/close the browser.

This may be a silly question, but how do I get IE to recognize the changes from these requests?


Solution

  • Try setting the cache: false parameter to your AJAX requests as browsers might cache GET requests:

    $.ajax({
        url: '/foo',
        type: 'GET',
        cache: false,
        success: function(result) {
            // TODO: update the DOM with the results
        }
    });