i working on a node.js code to post value using ajax url and json encode but I get this error when I try to export value from app.post
to app.get
to print it on a web page ReferenceError: output is not defined from this line
res.end(JSON.stringify(output));
so how i define this line on app.get ?
app.get('/insertmove', function (req, res, next) {
res.end(JSON.stringify(output));
});
app.post('/insertmove', function (req, res, next) {
var lMove="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
if(req.body.MoveString !== null){
Move.player.setMoveUserId = req.user.id ;
Move.player.setMoveString = req.body.MoveString;
a.InsertMove(req.user.GameId);
lMove=a.getLastMove(req.user.GameId);
}
var output = {"msg":lMove, "loggedin":true};
});
via dark night
No comments:
Post a Comment