javascript - query.first object always be undefined -
i have table name country,i key in country name find 1 correspond,but logs shows {object,object} , keep render message
"failed". please give me advice.
var redeemnum = req.body.redeemnum; var country = parse.object.extend("country"); var query = new parse.query(country); query.equalto("name", redeemnum); query.first({ success: function(object) { if (typeof object === 'undefined') { res.render("wrong", { msg : "failed!" } ); } else { res.render("wrong", { msg : "got it!" } ); } } })
i know may old ran , checked if object returned == null .. code here might like..
var redeemnum = req.body.redeemnum; var country = parse.object.extend("country"); var query = new parse.query(country); query.equalto("name", redeemnum); query.first({ success: function(object) { if (object == null) { res.render("wrong", { msg : "failed!" } ); } else { res.render("wrong", { msg : "got it!" } ); } } })
Comments
Post a Comment