Skip to content

Instantly share code, notes, and snippets.

@nesterchung
Created March 22, 2012 10:08
Show Gist options
  • Save nesterchung/2157535 to your computer and use it in GitHub Desktop.
Save nesterchung/2157535 to your computer and use it in GitHub Desktop.
JavavScript : Load Js with call back
//load external js
function loadJs(src, callback) {
s = document.createElement("script");
s.src = "src";
if (s.addEventListener) {
s.addEventListener("load", callback, false);
} else if (s.readyState) {
s.onreadystatechange = callback;
}
document.body.appendChild(s);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment