Why does the code below runs the error callback with no status? Web Developer in Firefox reports status code 200.
Is there any way to debug this?
<meta charset="utf8">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script>
<script type="text/javascript">
function RoomListCtrl($scope, $http) {
$scope.getRooms = function() {
$http({method: 'GET', url: 'http://code.angularjs.org'}).
success(function(data, status, headers, config) {
// this callback will be called asynchronously
// when the response is available
alert('succes');
}).
error(function(data, status, headers, config) {
// called asynchronously if an error occurs
// or server returns response with an error status.
alert('error');
});
}
$scope.submit = function() {
this.getRooms();
}
}
</script>
<body ng-controller="RoomListCtrl"><form ng-submit="submit()">
<input type="text" value="" ng-model="search" name="search" >
</form></body>
code.angularjs.orghas).