My client makes ajax call
{{ function callNode(){ console.log("I am called"); var data = {"emailId":" gopal@gmail.com "}; $.ajax({ type: 'POST', data: JSON.stringify(data), /* data: { blob: {wob:"1",job:"2", ar:[1,2,{a:'b'}]} },*/ contentType: "application/javascript", //contentType: "application/x-www-form-urlencoded", dataType:'json', url: 'http://localhost:3000/notification', success: function(data) { console.log('success'); console.log(JSON.stringify(data)); }, error: function(error) { console.log("some error in fetching the notifications"); } }); } }}
I can get this request in my app.js application, but I canβt get the data that I pass. I tried to search, but nothing works.
{{ app.post('/notification', function(req, res) { JSON.stringify(req.params); }}
The thing is that it is not included in any request and response events (as I saw, many people use this to get data.
Help me find out what's wrong here, its first time ajax on node
source share