Hello everyone.
I have a problem that I can not solve. Well, actually I’m not sure could be. The strange thing is that everything is fine using curl.
Here my service within the controller.
$scope.signIn = function(user) {
var url_service = "http://dominio.com/services_qp/";
// user : contains the form data
$http.post(url_service + "login2", user)
.success(function(responseData) {
if (responseData == 'false') {
$ionicLoading.show({
template: 'Error',
noBackdrop: true,
duration: 2000
});
}
else{
console.log(responseData);
}
})
.error(function(err) {
console.log(err);
$ionicLoading.show({
template: 'Something',
noBackdrop: true,
duration: 2000
});
});
};
By using the above code, I get the error 404 But if sending this form, everything works fine and returns me data.
curl -i -X POST -H 'Content-Type: application/json' -d '{"email": "usuario@gmail.com", "clave": "12345"}' http://dominio.com/services_qp/login2
HTTP/1.1 200 OK
Date: Thu, 18 Sep 2014 18:50:02 GMT
Server: Apache/2.2.14 (Ubuntu)
X-Powered-By: PHP/5.3.2-1ubuntu4.27
Access-Control-Allow-Origin: *
Vary: Accept-Encoding
Content-Length: 118
Content-Type: text/html
{"iduser":"1","status":"Dream Code xD","photo":"http:\/\/dominio.com\/services_qp\/img_user\/jmc.jpg"}
There a right way to do this.