Skip to content

Instantly share code, notes, and snippets.

@ksafranski
Created June 14, 2012 13:02
Show Gist options
  • Save ksafranski/2930143 to your computer and use it in GitHub Desktop.
Save ksafranski/2930143 to your computer and use it in GitHub Desktop.
Replacement for the jQuery $.getScript function with caching
$.getScript = function(url, callback, cache){
$.ajax({
url: url,
dataType: 'script',
success: callback,
cache: cache
});
};
@ksafranski
Copy link
Author

Usage:

$.getScript('/some/script.js', function(){ doSomething(); }, true);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment