Last active
September 27, 2023 11:21
-
-
Save dmiro/514be8942f99cde10e94999ea8be72ba to your computer and use it in GitHub Desktop.
load script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function loadScript (url, callback) { | |
// Adding the script tag to the head as suggested before | |
var head = document.head; | |
var script = document.createElement('script'); | |
script.type = 'text/javascript'; | |
script.src = url; | |
// Then bind the event to the callback function. | |
// There are several events for cross browser compatibility. | |
script.onreadystatechange = callback; | |
script.onload = callback; | |
// Fire the loading | |
// script.async=false; // cargar ya | |
head.appendChild(script); | |
} | |
var myPrettyCode = function() { | |
console.log("OK!"); | |
} ; | |
loadScript("my_script.py", myPrettyCode); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment