myApp.config(['$httpProvider', function ($httpProvider) {
$httpProvider.defaults.useXDomain = true;
delete $httpProvider.defaults.headers.common['X-Requested-With'];
}]);
$http.defaults.useXDomain = true;
$http.get('http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=asp+site:codehint.ru').
success(
function (data, status, headers, config) {
alert('answer');
}
);
Is not working! Because: Origin \site name\ is not allowed by Access-Control-Allow-Origin.
I have just started using AngularJS and forced to use $.getJSON because it is working fine in situation above. Can anybody show me the right solution of code above to make an AJAX call to outer services like Google?