Fixed #1999 by replacing the 'no-cache' parameter if it is there instead of just appending.

This commit is contained in:
David Serduke 2007-12-04 04:43:45 +00:00
parent 701b072e1a
commit aee221d33c
2 changed files with 38 additions and 3 deletions

View file

@ -197,8 +197,13 @@ jQuery.extend({
if ( s.dataType == "script" && s.cache == null )
s.cache = false;
if ( s.cache === false && s.type.toLowerCase() == "get" )
s.url += (s.url.match(/\?/) ? "&" : "?") + "_=" + (new Date()).getTime();
if ( s.cache === false && s.type.toLowerCase() == "get" ) {
var ts = (new Date()).getTime();
// try replacing _= if it is there
var ret = s.url.replace(/(\?|&)_=.*(&|$)/, "$1_=" + ts + "$2");
// if nothing was replaced, add timestamp to the end
s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");
}
// If data is available, append data to url for get requests
if ( s.data && s.type.toLowerCase() == "get" ) {