Skip to content

Instantly share code, notes, and snippets.

@menacestudio
Forked from mathiasbynens/jquery.loadasync.js
Created April 18, 2012 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save menacestudio/2417011 to your computer and use it in GitHub Desktop.
Save menacestudio/2417011 to your computer and use it in GitHub Desktop.
jQuery: Load scripts asynchronously
// Load scripts asynchronously
jQuery.loadAsync = function(url, callback) {
// Don't use $.getScript since it disables caching
jQuery.ajax({
'url': url,
'dataType': 'script',
'cache': true,
'success': callback || jQuery.noop
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment