【发布时间】:2014-03-18 00:10:57
【问题描述】:
在我的客户端代码中,我调用了 getContents():
$.getJSon("/getContents", function(room){
theRoom=$("#roomName").val();//textarea's value
...
});
在 getContents() 中,它位于服务器端代码 (index.js) 中,我如何使用 request.query 或任何其他函数来获取 theRoom(variable) 以便我可以获取基于 Room 的内容在它的标题(房间)上?
getContents();
var getContents=function(req,res){
...
var room=?
...
roomCollection.findOne({name: room}, function(err,theRoom){...
res.send(theRoom)
});
...
}
【问题讨论】:
-
index.js 文件是什么样的?
-
有人可以帮帮我吗?我还在苦苦挣扎
标签: javascript jquery web-applications express