Skip to content

Instantly share code, notes, and snippets.

@afuchs
Created October 7, 2013 19:25
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 afuchs/6873477 to your computer and use it in GitHub Desktop.
Save afuchs/6873477 to your computer and use it in GitHub Desktop.
function loadScript(src, callback) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = src;
if (callback) {
script.onreadystatechange = script.onload = function() {
callback();
};
}
document.body.appendChild(script);
}
// Example Usage
window.onload = function() {
loadScript('http://feather.aviary.com/js/feather.js', function() {alert('loaded');})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment