Internet Explorer has this annoying little habit of caching AJAX calls. This recently came out to bite me on a site I was working on which used AJAX to fill some drop-down boxes on an edit page. The first time through was fine (eg. editing an existing item). If I then created a new item, lo and behold the drop-down boxes were already selected on the previous item’s value!
This problem only occurs in IE, but there’s an easy solution. Write a quck javascript function as follows:
function uncache(url) {
var d = new Date();
var time = d.getTime();
return url + ((url.indexOf('?') == -1) ? '?' : '&') + 'time=' + time;
}
Then, whenever you make a parameterless AJAX call (eg. to /GetValues/), run it through the above function instead (eg. uncache(‘/GetValues/’) ).
