$http post data error


#1

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.


#2

have you find something i am having problem in $http


#3

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

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