summaryrefslogtreecommitdiff
path: root/share/www
diff options
context:
space:
mode:
Diffstat (limited to 'share/www')
-rw-r--r--share/www/script/jquery.couch.js20
1 files changed, 19 insertions, 1 deletions
diff --git a/share/www/script/jquery.couch.js b/share/www/script/jquery.couch.js
index d6aa512e..559fafd4 100644
--- a/share/www/script/jquery.couch.js
+++ b/share/www/script/jquery.couch.js
@@ -238,7 +238,7 @@
contentType: "application/json",
dataType: "json", data: toJSON(doc),
complete: function(req) {
- var resp = $.httpData(req, "json")
+ var resp = $.httpData(req, "json");
doc._id = resp.id;
doc._rev = resp.rev;
if (req.status == 201) {
@@ -251,6 +251,24 @@
}
});
},
+ bulkSave: function(docs, options) {
+ options = options || {};
+ $.ajax({
+ type: 'POST', url: this.uri + "_bulk_docs" + encodeOptions(options),
+ contentType: "application/json",
+ dataType: "json", data: toJSON({docs: docs}),
+ complete: function(req) {
+ var resp = $.httpData(req, "json");
+ if (req.status == 201) {
+ if (options.success) options.success(resp);
+ } else if (options.error) {
+ options.error(req.status, resp.error, resp.reason);
+ } else {
+ alert("The documents could not be saved: " + resp.reason);
+ }
+ }
+ });
+ },
removeDoc: function(doc, options) {
options = options || {};
$.ajax({