Hello,
the saveDoc function take the document to save in the first argument, and
options in the second arguiment...
function joinChannel(app, cname) {
var authorRand = Math.random().toString();
$("#frPage").submit(function() {
var apl, apid, first, last, dsc, email, _id;
apl = $("#app").val();
apid = $("#appid").val();
first = $("#first").val();
last = $("#last").val();
dsc = $("#desc").val();
email = $("#email").val();
if (apl) {
var message = {
_id:idGenerator(),
apinfo: { apl : apl, apid:apid, dsc:dsc
},
owner:{ first:first, last:last, email:email
},
date : new Date()
};
alert(JSON.stringify(message));
app.db.saveDoc( message,
{
"success": function () { alert ("document saved");},
"error": function () { alert ("document recording failed");}
}
);
}
return false;
})
Mickael
----- Mail Original -----
De: "tomy" <[email protected]>
À: [email protected]
Envoyé: Vendredi 11 Juin 2010 10h48:31 GMT +01:00 Amsterdam / Berlin / Berne /
Rome / Stockholm / Vienne
Objet: Re: couchdb local.ini set up
Thanks a lot guys for ur help I really appreciate it:
Could u please explain how can I modify
this 'app.db.saveDoc({channel:cname,message:message});' for my application,
how the saveDoc() function works
function joinChannel(app, cname) {
var authorRand = Math.random().toString();
$("#frPage").submit(function() {
var apl, apid, first, last, dsc, email, _id;
apl = $("#app").val();
apid = $("#appid").val();
first = $("#first").val();
last = $("#last").val();
dsc = $("#desc").val();
email = $("#email").val();
if (apl) {
var message = {
_id:idGenerator(),
apinfo: { apl : apl, apid:apid, dsc:dsc
},
owner:{ first:first, last:last, email:email
},
date : new Date()
};
alert(JSON.stringify(message));
app.db.saveDoc({channel:cname,message:message});
}
return false;
})
thanks