Here is the javascript implementation for the scriptDB API. It needs jQuery.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
* methodType = "GET"; */ var dataType = "json"; if(!postData) { u += "&callback=?"; dataType = "jsonp"; } var d = $.Deferred(); var headers = oa2 ? { Authentication: 'Bearer ' + oa2.getAccessToken() } : {}; // application headers /* headers["X-scriptDb-Application-Id"] = pPackage.clientKey; headers["X-scriptDb-REST-API-Key"] = pPackage.restAPIKey; */ $.ajax({ type: methodType, dataType: dataType, url: u, success: function (data) { d.resolve(data,defers); }, error:function(res, status, err) { d.reject("error " + err + " for " + url,defers); }, headers: headers, data : postData }); return d.promise(); }; } |
For help and more information join our forum, follow the blog or follow me on Twitter