Why does the post request in node.js output the source code directly in the console instead of displaying it on the page in the form of a web page when the render rendering template engine is used, and res.send () is also output in the console? thank you.
router.post("/user",function(req,res){
var idCard=req.body.idCards
var admTicket=req.body.admTickets;
var resdata={};
db.query("SELECT `admTicket` FROM `student` WHERE `idCard`=""+idCard+"";",function(err,data){
if(err)
{
resdata.type="fail";
resdata.message="";
}
else
{
if(data.length==0)
{
resdata.type="fail";
resdata.message="";
}
else
{
if(data[0].admTicket==admTicket)
{
resdata.type="success";
resdata.message="";
res.type("html");
res.render("test111");
}
else
{
resdata.type="fail";
resdata.message="";
console.log("no");
}
}
}
res.send(resdata);
});
});
the following is the effect: