Fixing problem in http POST request

Job ID: 33885226

Budget: $10 – $30 CAD

Hello,

I am getting error when I use mobile data. it works fine when I use wifi or when I use computer.

Basically I have to do 1 http post request, and it updates some data to server. but this http request gives some error sometimes but also works smooth sometimes. I don't understand this behaviour.

Anyone able to trouble shoot?

this is the post request below.
$http({
method: 'POST',
url: '../../myurl.php',
data: $.param({ 'data': $scope.activity_info }),
headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'Cache-Control': 'no-cache, no-store, must-revalidate',
'Pragma': 'no-cache',
'Expires': '0' },
cache: false

}).then(function (resp) {

}, function (error) {
console.log(error);
alert(JSON.stringify(error));

});


this is the error showing under callback error function.
{
"data":null,
"status":-1,
"config":{
"method":"POST",
"transformRequest":[
null
],
"transformResponse":[
null
],
"jsonpCallbackParam":"callback",
"url":"../../myurl.php",
"data":"all data that I pass are returned just",
"headers":{
"Content-Type":"application/x-www-form-urlencoded",
"Cache-Control":"no-cache, no-store, must-revalidate",
"Pragma":"no-cache",
"Expires":"0",
"Accept":"application/json, text/plain, /"
},
"cache":false
},
"statusText":"",
"xhrStatus":"error"
}
Related categories: PHP JavaScript AJAX Android AngularJS