$http.get(url) not working with own file on server


#1

I have the problem that with my own server i cant make a request.

When i use the exampe, it all works:

var url = ‘https://cors-test.appspot.com/test’;

.controller(‘MainCtrl’, function($scope, $http) {
$http.get(url).then(function(resp) {

}, function(err) {

})
})

but, when i use my own url, for example:
var url = ‘https://myServer.com/test’;

than i get err.status == 0

So i asked myself what is written in ‘https://cors-test.appspot.com/test’ ?

Maybe the content in my test-file is wrong. Or has it todo something with my server config ?

Furthermore, how can i call a php script ?


#2

since it is a zero status code, my guess is your own server does not support CORS. Look in the console window for xhr errors and/or start chrome with --disable-web-security to disable CORS checking in the browser.

CORS is coming about because your JavaScript and data are coming off different domains