Only if you set a security for that database. Otherwise, everyone can access that database, so, no login needed.
CGS On Thu, May 10, 2012 at 2:29 PM, goog cheng <[email protected]> wrote: > write doc into db via a couchapp , is a login necessary > > 在 2012年5月10日星期四,CGS 写道: > > > Hi Goog, > > > > One thing for sure: $.couch.db function accepts and asks for two > parameters > > (line 263 from jquery.couch.js) while in your script you pass only one > and > > that can make your browser to discard db variable, so, it interprets it > as > > undefined. That if you use the same version of jquery.couch.js I use > > (coming by default with CouchDB 1.2). > > > > I hope this will help you in debugging your script. > > > > CGS > > > > > > > > > > On Thu, May 10, 2012 at 1:13 PM, goog cheng <[email protected] > <javascript:;>> > > wrote: > > > > > Hi, all! , i have a problem , please help and see it, THX! > > > > > > chrome sas: Uncaught TypeError: Cannot call method 'db' of undefined > > > > > > I HAVE INCLUDE : > > > <script src="scripts/upload.js"></script> <script > > > src="/_utils/script/jquery.couch.js"></script> > > > > > > db = $.couch.db("doc"); function uploaddoc() { $('<h3>New > > > attachment</h3><table style="border:0px;"><tr valign="top"><td > > > style="border:0px;"><form id="attachment-form" name="attachment_form" > > > content-type="multipart/form-data"><input id="_attachments" type="file" > > > name="_attachments"/></form></td><td style="border:0px;">File > > > description:</td><td style="border:0px;"><form id="att-descr-form" > > > name="att_descr_form"><textarea name="attachdescr" style="height:50px; > > > width:450px;" ></textarea></form></td><td style="border:0px;"><button > > > id="upfly">Upload > > > File</button><br/></td></tr></table>').appendTo('#uploadfly'); > > > $("#upfly").click(function() { //alert("saved!1"); //alert("saved!2"); > > doc > > > = new Object; doc.date = Date().toString().substring(3, 15); > > > doc._attachments = document.getElementById("_attachments"); > > db.saveDoc(doc, > > > { success: function() { alert("saved!"); }, }); }); } > > > > > >
