SunMan SunMan - 1 year ago 171
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

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download