Skip to content

Instantly share code, notes, and snippets.

@jsoverson
Created October 26, 2012 17:21
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 jsoverson/3960064 to your computer and use it in GitHub Desktop.
Save jsoverson/3960064 to your computer and use it in GitHub Desktop.
Simple jsonp
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