$http.post doesn't work on iphone


#1

I am not sure what the issue is but I can’t get angular’s $http.post function to work:

.controller('channelCtrl', function($http) {
    var requestData = {
      "post":"/api/v1/post/" + postSlug + "/",
      "like_status": ture
    }   				
    
    $http.post("http://website.com/api/v1/postlike/", requestData, {
        headers: { 'Content-Type': 'application/json'}
    }).success(function(responseData) {
        console.log(responseData)
    }).error(function(err) {
        console.log(err)
    })
}

It WORKS in my browser but does not work on my device.

p.s. console.log does not return anything. It seems like the function doesnt get called at all


#2

Could it have something to do with Cordova’s access-origin in config.xml? http://docs.phonegap.com/en/1.9.0/guide_whitelist_index.md.html


#3

It could be. Well, according to the new docs (Version 3.4) you need to edit your config.xml files instead of Cordova.plist

I tried adding different variations of


but nothing helped:(


#4

Are there a error? “true”?? But I don’t know why you works in browser and not in your device.

Bye


#5

Hi there,
did you fix it?
i have the same problem.

thanks