My app ionic not sent data

hi everyone.

I have a problem with send data to restfull service, my service restfull not need key or login. is simple restful services.
well my code is here:

    $scope.SendData = function(){

        var sendData = [
            {
                id_customerorder:idcustomerorder,
                id_cart:idcartsend,
                customer_name:$scope.zupa.nombrecom,
                fb_id:fbid,
                tax_name:$scope.zupa.nombrecom,
                tax_number:$scope.zupa.nit,
                total_price:totalProduct,
                address:$scope.zupa.calle,
                address_number:$scope.zupa.numero,
                address_ref:$scope.zupa.refayuda,
                phone_ref:$scope.zupa.phone,
                latitude:lat,
                longitude:lng,
                order_date:orderdate,
                delivered:delivery
            }];

        var request = JSON.stringify(sendData);
        console.log(request);

zupafactoryio.ZupaSendData(request).success(function(ans){
console.log(‘ok this data is sent’);
console.log(ans);
}).error(function(error){
console.log(error);
});

    }

// services.js file
// this method send data to method customerorders

ZupaSendData:function(datas){
return $http.post(‘http://web.zupa.delivery/webservice/index.php/customerorders’,datas,{ headers: {‘Content-Type’: ‘application/x-www-form-urlencoded’} });
},

but showme an error like this

and I don’t know, why I have an error in my JSON like my imagen.

please help me

thanks for your attention

My reading of the error message is that your PHP service is returning something that cannot be parsed as JSON.

3 Likes

Your server get your request and send some wrong data in response.,So you have an error when your js try to use server response as JSON. In your page screen I can see that you passed empty access token, may be your server doesn’t work correct without it.

the problem it was on the server php,thanks for your advice