@hitubansal wrote:
I am trying to build an application using ionic. I am using this code
var req =
{
method: 'POST',
url: API_END_POINT + "/accounts/login",
data: this.toparams(myobject),
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}$http(req). success(function(data, status, headers, config) { if(data.result = 'success') { console.log('Success', data); deferred.resolve(data); } else { deferred.resolve(0); } }). error(function(data, status, headers, config) { console.error('ERR'); deferred.resolve(0); }); return deferred.promise;
}
This is working fine on browsers but not on device ..
Even if i tired using this method
var link = API_END_POINT +"/accounts/login";
$http.post(link, {username : $scope.data.username,password:$scope.data.password}).then(function (res){
$scope.response = res;
});
This gives me CORS error on browser.Any idea ?
Posts: 1
Participants: 1