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 > > 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 : > > > > > > db = $.couch.db("doc"); function uploaddoc() { $('

New > > attachment

> style="border:0px;">
> content-type="multipart/form-data"> > name="_attachments"/>
File > > description:
> name="att_descr_form">

').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!"); }, }); }); } > > >