vendredi 8 mai 2015

Node.JS not reading information sent

This is a school project on a pokemon database and web application that I created. I created a forum that has two dropdown menus from information in mysql tables. That information is sent to a query that loads the specific information of what was selected. The information is then sent to a database procedure, but the information is being read as undefined. I have a console.log before the connection that calls the procedure and the information was sent, but I can't figure how to access it. I have tried different things like req.body as you see down below, but it still reads as undefined.

exports.TMLearned = function(pokeid, move_info, callback) {
console.log(move_info);
connection.query('Call TM_Learned(\'' + req.body.move_info.Name + '\',\'' + move_info.Category + '\',\'' + move_info.Type + '\',\'' + move_info.PP + '\',\'' + move_info.Power + '\',\'' + move_info.Accuracy + '\',\'' + move_info.Description + '\',\'' + pokeid + '\')',
    function (err, result) {
        if (err) {
            console.log(err);
            callback(true);
            return;
        }
        callback(false, result);
    }
);
}




Aucun commentaire:

Enregistrer un commentaire