$http.get from AngularJS don't retrieve data from mysql database

I have these snippets of code :

APP.JS

app.controller('TypeCtrl', function($scope, $http){

        $http.get('http://localhost/Mobile/retrieveCabinet.php?zone=dakar&type=geometre')
            .success(function (response) {
                alert(response);
            })
            .error(function (response) {
                alert(response);
            });

});

app.config(function($stateProvider, $urlRouterProvider) {
    $stateProvider
        .state('auth', {
            url: '/auth',
            templateUrl: 'auth.html',
            controller: 'AuthCtrl'
        })
        .state('index', {
            url: '/home',
            templateUrl: 'home.html',
            controller: 'HomeCtrl'
        })
        .state('type', {
            url: '/second/:type',
            templateUrl: 'second.html',
            controller: 'TypeCtrl'
        });
    $urlRouterProvider.otherwise('/auth');
});

The controller "TypeCtrl" is tied to my page second.html (which contains just some links) but when I go to that page the method get from AngularJS pass to the error callback. Can someone know what might cause that failure ? Thanks in advance.

If you are testing it in browser, the request will fail as it is a cross domain request.

You can run Google chrome browser with disabling web security for test purpose to see if it will work in device,

start chrome from command line,

start "" "C:\Program Files\Google\Chrome\Application\chrome.exe" --user-data-dir="C:/Chrome dev session" --disable-web-security

Then browse your app to see if it works.

Hope this helps