aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Serduke <davidserduke@gmail.com>2007-12-04 04:43:45 +0000
committerDavid Serduke <davidserduke@gmail.com>2007-12-04 04:43:45 +0000
commitaee221d33c2db2c76639dabeca2b1e3d022e348e (patch)
tree34f4ed0cb005ace6c9fff31c91e6235b5b280d48 /src
parent701b072e1a104bce03df700c5f620d4000ccd573 (diff)
downloadjquery-aee221d33c2db2c76639dabeca2b1e3d022e348e.tar.gz
jquery-aee221d33c2db2c76639dabeca2b1e3d022e348e.zip
Fixed #1999 by replacing the 'no-cache' parameter if it is there instead of just appending.
Diffstat (limited to 'src')
-rw-r--r--src/ajax.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ajax.js b/src/ajax.js
index ba3aa968d..d4f2e1271 100644
--- a/src/ajax.js
+++ b/src/ajax.js
@@ -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" ) {