JavaScript XHR w/ GitHub API
I'm trying to use XHR to access the GitHub HTTP API, and I'm being rather badly defeated by the Same Origin Policy. I'm quite sure that easyXDM is overkill for this, but I don't know what else (if there is anything else) that I can use. Is there some easier way than easyXDM to get from my website to the GitHub API?
Turns out GitHub API supports JSON-P. from http://developer.github.com/v3/#json-p-callbacks:
You can send a
callback
parameter to any GET call to have the results wrapped in a JSON function. This is typically used when browsers want to embed GitHub content in web pages by getting around cross domain issues.
(emphasis mine)
This is your friend:
http://developer.github.com/v3/#cross-origin-resource-sharing
精彩评论