English 中文(简体)
查询时,Cuchapps 返回304
原标题:Couchapp returns 304 when querying a view

I am building a simple couchapp CRUD application. When I fetch a view, I get a 304 response from CouchDB. In futon, the same view returns documents. Below is the snippet where I am querying the view and appending the returned items to a div. In the javascript console, I get an error saying "Can not read property _id of null"

db = $.couch.db("itemly");
function updateItems(){
    $("#all").empty();
    db.view("itemly/byitemname",{ success: function(data){
     for (i in data.rows){
         $("#all").append( <div id="  + data.rows[i].value._id +  " class ="itemrow"><span> +data.rows[i].value.name + "</span><span>"+data.rows[i].value.price + "</span><span>"+data.rows[i].value.category + "</span><span>"+ <a href="#" id=" + data.rows[i].value._id +  " class = "edit"> Edit Item </a>  +"</span><span>"+ <a href="#" id=" + data.rows[i].value._id +  " class = "remove"> Remove Item </a>  +"</span></div>");
     }
    }
});
}

}
最佳回答

最后,我列举了这一问题。 I 旧

couchapp generate view byitemname

形成我的看法。 它创建了“地图”。 我根据我的要求编辑了地图。 j 案卷,当我放弃了意见时, co子的返回无效。

请注意,在福尔顿,“逐个点名”的观点是适当的,因为在福尔顿,你必须明确管理这一减少。 j ,但是,虽然从一只 app子中抽取,却自动发生。

问题回答

304 表示数据已经放在浏览器的切身处;就你而言,数据与200,只是更快。

如果仔细阅读错误,它就说,行价的值领域是无效的。 这意味着你正在做这样的事情:

emit("something", null);

在地图功能中,有观点。 您能否担任你的地图功能?





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签