Commit 49d0dc69 authored by Tristan Cavelier's avatar Tristan Cavelier

complex example updated

parent e64bd370
...@@ -217,7 +217,7 @@ var callback = function (err,val,begin_date) { ...@@ -217,7 +217,7 @@ var callback = function (err,val,begin_date) {
log ('return : ' + JSON.stringify (val)); log ('return : ' + JSON.stringify (val));
}; };
var command = function (method) { var command = function (method) {
var begin_date = Date.now(), doc = {}, opts = {}, other = {}; var begin_date = Date.now(), doc = {}, opts = {};
log (method); log (method);
if (!my_jio) { if (!my_jio) {
return error ('no jio set'); return error ('no jio set');
...@@ -230,10 +230,10 @@ var command = function (method) { ...@@ -230,10 +230,10 @@ var command = function (method) {
switch (method) { switch (method) {
case 'putAttachment': case 'putAttachment':
other.docid = $('#document_id').attr('value'); doc._id = $('#document_id').attr('value');
other.revision = $('#prev_rev').attr('value'); doc._rev = $('#prev_rev').attr('value');
other.content = $('#content').attr('value'); doc._data = $('#content').attr('value');
other.mimetype = $('#mimetype').attr('value'); doc._mimetype = $('#mimetype').attr('value');
log ('docid: '+ other.docid); log ('docid: '+ other.docid);
log ('revision: '+ other.revision); log ('revision: '+ other.revision);
log ('content: '+ other.content); log ('content: '+ other.content);
...@@ -260,6 +260,7 @@ var command = function (method) { ...@@ -260,6 +260,7 @@ var command = function (method) {
log ('opts: ' + JSON.stringify (opts)); log ('opts: ' + JSON.stringify (opts));
switch (method) { switch (method) {
case "putAttachment":
case 'remove': case 'remove':
case 'post': case 'post':
case 'put': case 'put':
...@@ -273,14 +274,6 @@ var command = function (method) { ...@@ -273,14 +274,6 @@ var command = function (method) {
callback(err,val,begin_date); callback(err,val,begin_date);
}); });
break; break;
case 'putAttachment':
my_jio[method](
other.docid, other.revision, other.content,
other.mimetype, opts, function (err, val) {
callback(err,val,begin_date);
}
);
break;
} }
}; };
var post = function () { var post = function () {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment