Skip to content
Permalink
Browse files

Data Ajax: Prevents the caching of nested scripts

  • Loading branch information...
LaurentGoderre committed Nov 27, 2014
1 parent 3ac7496 commit a3db8713dcf70610bfdfb403e61c24a42ff0d432
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/plugins/data-ajax/data-ajax.js
@@ -89,7 +89,7 @@ $document.on( "timerpoke.wb " + initEvent + " " + updateEvent + " ajax-fetched.w
"prepend"
],
len = ajaxTypes.length,
$elm, ajaxType, i, content;
$elm, ajaxType, i, content, jQueryCaching;

for ( i = 0; i !== len; i += 1 ) {
ajaxType = ajaxTypes[ i ];
@@ -117,12 +117,19 @@ $document.on( "timerpoke.wb " + initEvent + " " + updateEvent + " ajax-fetched.w
content = event.fetch.response;
if ( content ) {

//Prevents the force caching of nested resources
jQueryCaching = jQuery.ajaxSettings.cache;
jQuery.ajaxSettings.cache = true;

// "replace" is the only event that doesn't map to a jQuery function
if ( ajaxType === "replace") {
$elm.html( content );
} else {
$elm[ ajaxType ]( content );
}

//Resets the initial jQuery caching setting
jQuery.ajaxSettings.cache = jQueryCaching;
}
}
}

0 comments on commit a3db871

Please sign in to comment.
You can’t perform that action at this time.