javascript - Is there another way to disable cache when fetching script? -


i use fetch script;

$.getscript("http://www.example.org/"); 

however, dont want cached. means if use getscript again, script should fetch again.

this 1 works in theory;

$.getscript("http://www.example.org/?" + math.random()); 

but in practically, it's not. because "?" disabled on remote site url, question is, there otherway tell browser not cache ?

recreate function needs:

(function () {     $.getscript = function(url, callback) {         $.ajax({                 type: "get",                 url: url,                 success: callback,                 datatype: "script",                 cache: false         });     }; })(); 

now won't cache anymore when call function like

$.getscript('script.js', function() {     // non cached script.js }); 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -