I go through the Angularjs phone tutorial and want to get JSON phones from a remote server.
$http.get('http://myserver.com/phones.json').success(function(data) { $scope.phones = data; });
This failed due to CORS, I did not send OPTIONS a GET request, so I added this first line to the controller
delete $http.defaults.headers.common['X-Requested-With'];
Now I can see in Charles that GET not OPTIONS request is being made on myserver.com and that the answer contains JSON phones. But http.get still does not work with status 0, and "data" is null.
Not sure what to try next. Any ideas were appreciated.
source share