I am trying to use AngularJS to make a http get call:
<script>
function customersController($scope,$http) {
$http.get('http://www.mee.wherego.ca/api/test/get')
.success(function(response) {$scope.names = response;})
.error(function(response) {
if (response) {$scope.result = response; }
else { $scope.result = 'null'; } });
}
</script>
From UI (Html code), the response is "null" which means response is undefined; however from firefox debugger, it returns a 200 status code but with the following error:
If I just type in the URL in Firefox's address bar, the JSON returned is:
{"execution_result":"passed",
"execution_timestamp":"2015-01-26 16:21:35.856",
"exception":null,
"message":null}
And JSONLint says this is a valid JSON.
In order to eliminate CORS possibility, I also tried to use Apache's CloseableHttpClient to make the get call, and that successfully returned the JSON. I think this tells me the CORS is not an issue.
I am not sure what is going on here; is it really something wrong with the JSON, or is it something wrong with http.get
? I am really confused.