Skip to content

Instantly share code, notes, and snippets.

@Raynos

Raynos/x.js Secret

Created April 3, 2013 18:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Raynos/e911b554d0fb5e0709e1 to your computer and use it in GitHub Desktop.
Save Raynos/e911b554d0fb5e0709e1 to your computer and use it in GitHub Desktop.
var querystring = require("querystring")
var uuid = require("uuid")
function jsonp(uri, options, cb) {
var script = document.createElement("script")
var id = uuid()
script.src = uri + "/?" + querystring.stringify(options) +
"&cb=__jsonp_"+id
window["__jsonp_" + id] = cb
document.body.appendChild(script)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment