Could anyone tell me why the following statement does not send the post data to the designated url? The url is called but on the server when I print $_POST - I get an empty
I also faced similar problem and i was doing something like this and that didn't worked. My Spring controller was not able read data parameter.
var paramsVal={data:'"id":"1"'};
$http.post("Request URL", {params: paramsVal});
But reading this forum and API Doc, I tried following way and that worked for me. If some one also have similar problem, You can try below way as well.
$http({
method: 'POST',
url: "Request URL",
params: paramsVal,
headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'}
});
Please check https://docs.angularjs.org/api/ng/service/$http#post for what param config does. {data:'"id":"1"'} – Map of strings or objects which will be turned to URL?data="id:1"