SunMan SunMan - 6 months ago 115
AngularJS Question

ionic $http post not sending data

I am trying to post data to a web service but the data is missing.

Here is the code

var product = {
CategoryID: 'test'

url: URL,
method: "POST",
data: product,
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
.success(function(data,status,headers,config) {
.error(function(data,status,headers,config) {

The POST data on the server is empty.

I have set up Access-Control-Allow-Origin,Access-Control-Allow-MethodAccess-Control-Allow-Headerss and Access-Control-Allow-Headers on the server.

This API works fine when tested through Postman


For your issue try a look at this one How do I POST urlencoded form data with $http in AngularJS? - you probably need to transform your request in order to sent in via $http service with the required content type.