Provide a JSONP callback if necessary on a remote loaded script
Takes a JSONP script (one that has a callback=) in the query string and a callback and provides a new script URL specifiying a new callback which wraps the passed in callback. The included script will call the provided callback, ensuring your callback is only called when the JSONP script has finished loading.
This sort of assumes you're using something to let you use CommonJS modules on the browser end.
var jsonpject = require'jsonpject';do_something_withdata;var jsonp = jsonpject'?';windowjsonpfn_name = jsonpfn;var scr = documentcreateElement'script';scrsrc = jsonpurl;documentheadappendChildscr;
Uses grunt to do testing. Test is available from npm
JSONPject is provided under the terms of the MIT License Copyright 2013 Condé Nast