IE Caching Ajax Results – How to fix

10 thoughts on “IE Caching Ajax Results – How to fix”

  1. there are some typos in your code:

    $(document).ready(function()
    {
    Sys.Net.WebRequestManager.add_invokingRequest(_onServiceRequestInvoke);
    });

    function _onServiceRequestInvoke(sender, networkRequestEventArgs)
    {
    var now = new Date();
    var requestUrl = networkRequestEventArgs._webRequest._url;
    var uniqueUrl = (requestUrl.indexOf(“?”) > -1 ? “&” : “?”) + “nocache=” + now.getMilliseconds() + now.getSeconds() + now.getMinutes();
    networkRequestEventArgs._webRequest._url = requestUrl + uniqueUrl;
    }

  2. $.ajax({
    type: “GET”,
    url: this._baseURL + method,
    cache: false
    data: data,
    contentType: “application/json; charset=utf-8″,
    dataType: “json”,
    success: fnSuccess
    });

    This method does not work for me, i am not sure why. But if you can give a more specific example?

    Thanks!
    D.

    1. Hi Dung,

      Im very happy to hear this post was helpful to you.

      Can you elaborate a bit what is it that doesnt work for you with the jquery example?
      Are you getting an error or what exactly?

  3. This code will work in IE

    $.ajax({
    type: “GET”,
    url: this._baseURL + method,
    cache:$.ajaxSetup({
    cache: false
    }),
    data: data,
    contentType: “application/json; charset=utf-8″,
    dataType: “json”,
    success: fnSuccess
    });

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s