Prototype based Ajax.ScriptRequest to load JSON data from other domains.
Basic usagenew Ajax.ScriptRequest(url, options);
// Example
new Ajax.ScriptRequest("http://api.flickr.com/services/rest/", {
parameters: {
method:"flickr.tags.getHotList",
format: "json",
api_key: "xyz"
},
onResponse: myResponse,
callbackName: "jsoncallback"
});Extended usagenew Ajax.FlickrRequest(method, options);
new Ajax.FlickrRequest("flickr.tags.getHotList", {
onResponse: myResponse
});Demohttp://script-request.googlecode.com/svn/trunk/index.html
ExtensionsAjax.DeliciousRequest Ajax.FlickrRequest Ajax.YahooImageSearch Ajax.XmlJsonRequest ... Sample extension implementationAjax.FlickrRequest = Ajax.ScriptRequest.extend({
setOptions: function(options){
this.url = "http://api.flickr.com/services/rest/?method=" + this.url;
this.options = {
callbackName: "jsoncallback",
parameters: {
api_key: "xyz",
format: "json"
}
};
}
});
// call your new extension:
new Ajax.FlickrRequest("flickr.tags.getHotList", myCallback);Downloadhttp://script-request.googlecode.com/svn/trunk/scripts/ScriptRequest.js http://script-request.googlecode.com/svn/trunk/scripts/ScriptRequestExtensions.js AuthorMartin Kleppe
Send Mail
30 Day Summary May 17 2013 — Jun 16 2013
|
12 Month Summary Jun 16 2012 — Jun 16 2013
|
Copyright
©
2013
Black Duck Software, Inc.
and its contributors, Some Rights Reserved. Unless otherwise marked, this work is licensed under a
Creative Commons Attribution 3.0 Unported License
. Ohloh
®
and the Ohloh logo are trademarks of
Black Duck Software, Inc.
in the United States and/or other jurisdictions. All other trademarks are the property of their respective holders.