IE browser issue while sending ajax requests.

IE browser does not send ajax request if the url is same, simply get the results from cache. To avoid this and make a new request, we should append a no-cache parameter to each ajax request url.

getNoCacheValue(url) – method for dynamically getting current time in milliseconds and append that value to no-cache parameter.

function getNoCacheValue(url)
var d = new Date();
var appendstring = (url.indexOf(“?”) != -1) ? “&” : “?”;
var nocachevalue = appendstring + “no-cache=” + d.getTime();
return nocachevalue

sendAjaxRequest(url, divid) – method to send a ajax request and write the response text to given divid. In this method, getNoCacheValue(url) method called to avoid the cache problem in IE browser.

function sendAjaxRequest(url, divid)
url = url + getNoCacheValue(url);
var req = getXMLHttpRequest();
req.onreadystatechange = function(){ processResponse(req, divid) };‘GET’, url, true);

Ajax Basics –
Ajax GET request –
Ajax POST request –

IE browser failed to execute scripts in ajax response –

Tags: , , , , , ,

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: