【发布时间】:2012-01-07 23:48:17
【问题描述】:
我正在使用 now.js 和 nano(CouchDB 库)来用选项填充选择。
服务器:
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);
});
};
客户:
$(document).ready(function() {
now.getThings($('select#thing').val());
$("#poke").click(function() {
now.getThings($('select#thing').val());
});
});
在客户端它说第一次调用“TypeError: 'undefined' is not a function”。在 .click()-Function 中一切正常。
now.js 在 application.js 之前加载。我也尝试了 $(now).ready(),但没有成功。
有什么问题?
【问题讨论】:
标签: javascript node.js couchdb nowjs-sockets couchdb-nano