Created
July 22, 2013 08:11
-
-
Save gaishimo/6052141 to your computer and use it in GitHub Desktop.
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
var JSONP_API = {}; | |
function loadJS(src){ | |
var script = document.createElement('script'); | |
script.src = src; | |
var body = document.body; | |
body.appendChild(script); | |
} | |
JSONP_API.callback1 = function(data){ | |
console.log("callback1", data); | |
}; | |
loadJS('http://127.0.0.1:3000/api?callback=JSONP_API.callback1' ); | |
JSONP_API.callback2 = function(data){ | |
console.log("callback2", data); | |
}; | |
loadJS('http://127.0.0.1:3000/api?callback=JSONP_API.callback2' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment