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