【发布时间】:2014-04-23 12:38:00
【问题描述】:
在我的客户端代码中,我调用了 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)
});
...
}
【问题讨论】:
标签: javascript jquery