Skip to content

Does a JSON (crossdomain) request and retrieves the result as a parsed object

Notifications You must be signed in to change notification settings

japetheape/jsoncrossdomainrequest

Repository files navigation

JSONCrossdomainRequest

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.


h2. Installation

Download the files and place them somewhere:

  • JSONCrossdomainRequest.swf
  • JSONCrossdomainRequest.js
  • swfobject.js


h2. Usage

Include the javascript in your file:


	<script src="swfobject.js" type="text/javascript"></script>
	<script src="JSONCrossdomainRequest.js" type="text/javascript"></script>

Set location of SWF if it is not in your root

JSONCrossdomainRequest.fSwfLocation = ‘/otherlocation/JSONCrossdomainRequest.swf’

Init the JSONCrossdomainRequest object


	window.onload = function() {
		JSONCrossdomainRequest.init();
	}

Do the call and define a callback


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);
	}
}


h2. License

JSONCrossdomainRequest is released under the MIT license. Please contact (jaapvandermeer AT gmail DOT com) if you have any suggestions or remarks.

About

Does a JSON (crossdomain) request and retrieves the result as a parsed object

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published