请帮我。我的搜索使用帖子中需要变量:
app.post('/find', function(req, res) {
var id_school = req.body.std_id;
console.log('show '+ id_sekolah);
db.collection('ak_test_score', function(err, collection) {
collection.find({'std_id':id_school}).toArray(function(err, level) {
var a = level.std_id;
var b = level.school_name;
});
});
res.redirect('/test_score'); // send to my page to get
};
var test = a; // not defined variable a not have
app.get('/test_score', function(req, res) {
var id_school = test;
console.log('show '+ id_sekolah);
db.collection('ak_test_score', function(err, collection) {
collection.find({'std_id':id_school}).toArray(function(err, level) {
res.send(level)
});
});
};
我正在使用它来使用帖子进行网站搜索。