summaryrefslogtreecommitdiffabout
path: root/content/flickr.js
Side-by-side diff
Diffstat (limited to 'content/flickr.js') (more/less context) (ignore whitespace changes)
-rw-r--r--content/flickr.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/content/flickr.js b/content/flickr.js
index e09d5f0..545144c 100644
--- a/content/flickr.js
+++ b/content/flickr.js
@@ -120,2 +120,22 @@ Flickr.prototype = {
},
+ api_call_json: function(params,on_success,on_failure) {
+ if(params.auth_token=='default') params.auth_token=this.token;
+ params.format = 'json'; params.nojsoncallback=1;
+ var x = new XMLHttpRequest();
+ x.open("GET",this.api_call_url(params));
+ x.onreadystatechange=function() {
+ if(x.readyState!=4) return false;
+ if(x.status==200) {
+ var rsp=JSON.parse(x.responseText);
+ if(rsp.stat=='ok')
+ on_success && on_success(x,rsp);
+ else
+ on_failure && on_failure(rsp,rsp.stat,rsp.code,rsp.message);
+ }else
+ on_failure && on_failure(x);
+ return true;
+ };
+ x.send(null);
+ return true;
+ },
api_call: function(params, on_success, on_failure) {