This file contains hidden or 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
if (typeof jQuery == 'undefined') { | |
function getScript(url, success) { | |
var script = document.createElement('script'); | |
script.src = url; | |
var head = document.getElementsByTagName('head')[0], | |
done = false; | |
// Attach handlers for all browsers | |
script.onload = script.onreadystatechange = function() { | |
if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) { | |
done = true; | |
// callback function provided as param | |
success(); | |
script.onload = script.onreadystatechange = null; | |
head.removeChild(script); | |
}; | |
}; | |
head.appendChild(script); | |
}; | |
getScript('http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js', function() { | |
console.log("done") | |
}); | |
} else { | |
alert("Could not load jQuery!") | |
}; |
No comments:
Post a Comment