Do crossdomain json requests in javascript without hassles. Works with a flash proxy object. This object parses the JSON for you, so there will be no character encoding problems when sending the data to javascript.
Download the files and place them somewhere:
- JSONCrossdomainRequest.swf
- JSONCrossdomainRequest.js
- swfobject.js
<script src="swfobject.js" type="text/javascript"></script>
<script src="JSONCrossdomainRequest.js" type="text/javascript"></script>
JSONCrossdomainRequest.fSwfLocation = ‘/otherlocation/JSONCrossdomainRequest.swf’
window.onload = function() {
JSONCrossdomainRequest.init();
}
function callback(pObject) {
alert(pObject)
}
window.onload = function() {
JSONCrossdomainRequest.init();
JSONCrossdomainRequest.onLoadComplete = function() {
JSONCrossdomainRequest.doRequest('http://localhost:4000/items.json?per_page=20?page=1', "", 'GET', callback);
}
}
JSONCrossdomainRequest is released under the MIT license. Please contact (jaapvandermeer AT gmail DOT com) if you have any suggestions or remarks.