add bulkSave method to jquery.couch.js

git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@765419 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/jquery.couch.js b/jquery.couch.js
index 9399ec1..3c629e1 100644
--- a/jquery.couch.js
+++ b/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({