Reputation: 158
My Angular Js app fails when im trying to fetch json data from my web server ( made with codeigniter ). Other urls which respond with json data works fine but mine some how doesn't.
Angular js code:
.controller('DashCtrl', function($scope, $http) {
$http.get('http://appbackend.wrappic.nl/')
.success(function(data, status, headers, config) {
})
.error(function(data, status, headers, config) {
// log error
console.log("Error");
});
});
Many thanks!
Upvotes: 1
Views: 107
Reputation: 26
If it works on other servers, but not your own, I think that you miss a 'Access-Control-Allow-Origin' header.
Try adding the header at the top of your PHP page like such:
header('Access-Control-Allow-Origin: *');
Upvotes: 1