I am trying to send JSON data to a node instance using an ajax get request clientside request as shown below:
var parameters = { username: 'test' }; $.ajax({ url: url, data: JSON.stringify(parameters), success: function {}, dataType: 'json' });
Using firebug, I see that it sends encoded http: // server / web_svc? Username = test
in my express node method:
function svc_method(req, res) { var username = req.body.username; }
req.body.username undefined. It only works if I send instead.
How to fix this problem? I have the line app.use (express.bodyParser ()) at the top of app.configure ().
source share