add_brand(bDesc,captionid){ console.log(bDesc); ***print correct value*** this.http.post("http://localhost:3000/add_Brand",{bDesc,captionid}).subscribe( (res) => { console.log("record INSERTEDw"); //working True this.table.renderRows(); }, (error) => {console.log(error)} ); }
const bodyParser=require('body-parser'); app.post("/add_brand",(req,res)=>{ console.log(req.body.bdesc); ***print undefined*** const insertquery="INSERT INTO brandtbl (BDesc,CaptionCode) VALUES ('" + req.body.bdesc + "'," + req.body.captionid + ")"; ConnectToDB().query(insertquery,(err,result)=>{ if (err){ console.log("error"+err); res.sendStatus(500); return; } else{ console.log("record inserted"); res.end();} }) });
Quote:this.http.post("http://localhost:3000/add_Brand",{bDesc,captionid}).subscribe
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)