// the class Request.flickr = new Class({ Extends: Request.JSONP, options: { callbackKey: "jsoncallback", url: "http://www.flickr.com/services/rest/?", log: true }, initialize: function(params, options) { this.parent(options); this.options.url = this.options.url + Object.toQueryString(params); }, success: function(data, script) { this.parent(data, script); }, imageURL: function(obj) { return "http://farm{farm}.static.flickr.com/{server}/{id}_{secret}.jpg".substitute(obj); } }); // how to use new Request.flickr({ format: 'json', api_key: "e7df6c74d2545f55414423463bf99723", // your api here per_page: 4, tags: "mountains", method: "flickr.photos.search" }, { onSuccess: function(data) { target = $("action"); var self = this; data.photos.photo.each(function(el) { new Asset.image(self.imageURL(el), { onload: function() { this.inject(target); } }); }); } }).send();
<div id="action">ready</div>