From 7ac8071d93b07dd50afe72395052e285f6cc3509 Mon Sep 17 00:00:00 2001 From: Christopher Lenz Date: Sun, 25 May 2008 14:15:53 +0000 Subject: Improve jQuuery-based CouchDB interface so that it doesn't report an error when no 'success' callback was provided. git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@659989 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/jquery.couch.js | 52 ++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'share/www/script') diff --git a/share/www/script/jquery.couch.js b/share/www/script/jquery.couch.js index 71a3c787..11ae4340 100644 --- a/share/www/script/jquery.couch.js +++ b/share/www/script/jquery.couch.js @@ -20,8 +20,8 @@ type: "GET", url: "/_all_dbs", complete: function(req) { var resp = $.httpData(req, "json"); - if (req.status == 200 && options.success) { - options.success(resp); + if (req.status == 200) { + if (options.success) options.success(resp); } else if (options.error) { options.error(req.status, resp.error, resp.reason); } else { @@ -43,8 +43,8 @@ type: "POST", url: this.uri + "_compact", dataType: "json", complete: function(req) { var resp = $.httpData(req, "json"); - if (req.status == 202 && options.success) { - options.success(resp); + if (req.status == 202) { + if (options.success) options.success(resp); } else if (options.error) { options.error(req.status, resp.error, resp.reason); } else { @@ -59,8 +59,8 @@ type: "PUT", url: this.uri, dataType: "json", complete: function(req) { var resp = $.httpData(req, "json"); - if (req.status == 201 && options.success) { - options.success(resp); + if (req.status == 201) { + if (options.success) options.success(resp); } else if (options.error) { options.error(req.status, resp.error, resp.reason); } else { @@ -75,8 +75,8 @@ type: "DELETE", url: this.uri, dataType: "json", complete: function(req) { var resp = $.httpData(req, "json"); - if (req.status == 202 && options.success) { - options.success(resp); + if (req.status == 202) { + if (options.success) options.success(resp); } else if (options.error) { options.error(req.status, resp.error, resp.reason); } else { @@ -91,8 +91,8 @@ type: "GET", url: this.uri, dataType: "json", complete: function(req) { var resp = $.httpData(req, "json"); - if (req.status == 200 && options.success) { - options.success(resp); + if (req.status == 200) { + if (options.success) options.success(resp); } else if (options.error) { options.error(req.status, resp.error, resp.reason); } else { @@ -109,8 +109,8 @@ dataType: "json", complete: function(req) { var resp = $.httpData(req, "json"); - if (req.status == 200 && options.success) { - options.success(resp); + if (req.status == 200) { + if (options.success) options.success(resp); } else if (options.error) { options.error(req.status, resp.error, resp.reason); } else { @@ -128,8 +128,8 @@ dataType: "json", complete: function(req) { var resp = $.httpData(req, "json"); - if (req.status == 200 && options.success) { - options.success(resp); + if (req.status == 200) { + if (options.success) options.success(resp); } else if (options.error) { options.error(req.status, resp.error, resp.reason); } else { @@ -155,8 +155,8 @@ var resp = $.httpData(req, "json") doc._id = resp.id; doc._rev = resp.rev; - if (req.status == 201 && options.success) { - options.success(resp); + if (req.status == 201) { + if (options.success) options.success(resp); } else if (options.error) { options.error(req.status, resp.error, resp.reason); } else { @@ -173,8 +173,8 @@ dataType: "json", complete: function(req) { var resp = $.httpData(req, "json"); - if (req.status == 202 && options.success) { - options.success(resp); + if (req.status == 202) { + if (options.success) options.success(resp); } else if (options.error) { options.error(req.status, resp.error, resp.reason); } else { @@ -201,8 +201,8 @@ data: toJSON(body), dataType: "json", complete: function(req) { var resp = $.httpData(req, "json"); - if (req.status == 200 && options.success) { - options.success(resp); + if (req.status == 200) { + if (options.success) options.success(resp); } else if (options.error) { options.error(req.status, resp.error, resp.reason); } else { @@ -218,8 +218,8 @@ dataType: "json", complete: function(req) { var resp = $.httpData(req, "json"); - if (req.status == 200 && options.success) { - options.success(resp); + if (req.status == 200) { + if (options.success) options.success(resp); } else if (options.error) { options.error(req.status, resp.error, resp.reason); } else { @@ -237,8 +237,8 @@ type: "GET", url: "/", dataType: "json", complete: function(req) { var resp = $.httpData(req, "json"); - if (req.status == 200 && options.success) { - options.success(resp); + if (req.status == 200) { + if (options.success) options.success(resp); } else if (options.error) { options.error(req.status, resp.error, resp.reason); } else { @@ -256,8 +256,8 @@ contentType: "application/json", complete: function(req) { var resp = $.httpData(req, "json"); - if (req.status == 200 && options.success) { - options.success(resp); + if (req.status == 200) { + if (options.success) options.success(resp); } else if (options.error) { options.error(req.status, resp.error, resp.reason); } else { -- cgit v1.2.3