I use getScript to load dynamically my plugin:
$.getScript(\'js/code.photoswipe.jquery-3.0.4.min.js\', function () {
//do magic
});
The jQuery docs for $.getScript say that getScript is shorthand for:
$.ajax({
url: url,
dataType: "script",
success: success
});
http://api.jquery.com/jQuery.getScript/
This means that you just need to add a cache : true parameter to that.
$.ajax({
url: url,
cache : true,
dataType: "script",
success: success
});
Simple as that. The getScript function is nothing special, just shorthand.