I have an application using Angular JS. At the time of making a request to the backend that I have in PHP. It throws me the following error.
The error only appears when I use the application from another device that is not the server.
To make the request, I use the following method:
utils.getHttp = function (getAuth, getUrl, getData){ // Boleano, si necesita autorizacion, URL de la peticion, y un objeto con los datos.
return $http({
method: 'POST',
skipAuthorization: getAuth,
url: getUrl,
data: getData,
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}).then(function successCallback(response) {
//console.log(response);
if ('error' in response.data) {
return $q.reject(response);
}
return response;
}).catch(function errorCallback(response) {
console.error(response);
return $q.reject(response.data);
});
}