I am having trouble with posting to a URL with GET parameters using Angular's $http.
URL: http://localhost/api/?r=page/product
Now I have to post data to this URL via AJAX. When I try it with the following code it doesn't work.
$http({
url:'api/?r=page/product',
method:'post',
params:{
price:$scope.price
},
});
Where as the same in jQuery Works flawlessly.
$.ajax({
url:'api/?r=page/product',
method:'post',
data:{
price:$scope.price
}
});
What should I add to make it work?
Regards
$httpoptionheaders: {'Content-Type': 'application/x-www-form-urlencoded'}application/x-www-form-urlencodedif we donn't set any header with the request. Is it wrong sir ?url-encodeditsjson object