Javascript 客户端带有now.js的未定义函数
我使用now.js和nano(CouchDB库)来填充一个select选项 服务器:Javascript 客户端带有now.js的未定义函数,javascript,node.js,couchdb,nowjs-sockets,couchdb-nano,Javascript,Node.js,Couchdb,Nowjs Sockets,Couchdb Nano,我使用now.js和nano(CouchDB库)来填充一个select选项 服务器: everyone.now.getThings = function(thing) { var self = this; return db.view('lists', 'some_things', function(error, data) { var list = data.rows.map(function(obj) { return '<option value="' +
everyone.now.getThings = function(thing) {
var self = this;
return db.view('lists', 'some_things', function(error, data) {
var list = data.rows.map(function(obj) {
return '<option value="' + obj['id'] + '">' + obj['value'] + '</option>';
});
return self.now.receiveThings(list);
});
};
在客户机上,它在第一次调用时说“TypeError:‘undefined’不是函数”。在.click()函数中,一切正常
现在,在application.js之前加载了.js。我也尝试了$(now).ready(),但没有成功
问题出在哪里?我通过在jade模板调用中包含第一组数据来解决问题,并在select上创建了一个.change()处理程序
$(document).ready(function() {
now.getThings($('select#thing').val());
$("#poke").click(function() {
now.getThings($('select#thing').val());
});
});