Created
October 26, 2012 17:21
-
-
Save jsoverson/3960064 to your computer and use it in GitHub Desktop.
Simple jsonp
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 jsonp(src,cb){ | |
var script = document.createElement('script'); | |
var previousCall = document.getElementById('srvCall'); | |
previousCall && document.body.removeChild(previousCall); | |
script.charset = 'UTF-8'; | |
script.id = 'srvCall'; | |
document.body.insertBefore(script, document.body.firstChild); | |
script.src = src; | |
window.serverCallback = cb; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment