$http post data error


Hi everybody, I’m working with $http.post and i got this problem.
When i send a post request like this:

var data = {"test": "message content"};
$http.post(url, data) 

and in servlet, i can’t get “test” parameter.
But when i send post request like this:

$http.post(url + "?test="content");

In servlet, i can get the post data.
I don’t know what is the problem here. Can you explain the issue here. Thanks very much.


have you find something i am having problem in $http


You are using a wrong syntax… Don’t use Quotes (" ") . Use quotes only if it a string …

var username = “XYZ”;
$http.post(url, {username: username, password: password});
$http.post(url, {username: “XYZ”, password: password});