Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49076

Http POST Connection ERROR

$
0
0

@FranCaduceo wrote:

Hello, thanks to all community for the help.

I have a problem with my controller, when I try to 'sig in' in my app using the movil device, I can not connect with the server, but when I try the same code in the browser I do not have problem to connect or work with the app.
This problem only appear when I am working from movil device.

This is my controller code:

.controller('LoginCtrl', function($scope, $state, $http, UserFtry) {
$scope.logIn = function(user){
$scope.user = {};
$scope.user.username = "";
$scope.user.password = "";

    if(user == null){
        $scope.user.response = "Debe rellenar los campos Usuario y Contraseña.";
        $scope.user.username = "";
        $scope.user.password = "";
    }else{
        return $http({
            url : '/loginAccess',
            method : 'POST',
            data : {'usuario': user.username,'password': user.password},
            headers : { 'Content-Type' : 'application/json' }
        }).success(function(result) {
            if (result == "Error"){
                $scope.user.response = "Usuario o contraseña incorrectos.";
                $scope.user.usuario = "";
                $scope.user.password = "";
            }else{
                UserFtry.data.usuario = result[0];
                $state.go('tab.home');
            }
        }).error(function(result){
            $scope.user.response = "Error de conexión";
        });
    }
};

})

I have tried different codes but I always get the same result. I can not obtain the success result, only error, as I said this only happens on movil device.

I am working in ANDROID platform.

Thanks for all.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 49076

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>