javascript - Angularjs $http cant get data but can get from $jquery.ajax -
i tired data off api using jquery.ajax() , works fine here code that: $.ajax({ url: "http://api.somesite.com/api?format=json", type: "get", //it works post datatype: 'jsonp', }) .done(function( data ) { if ( console && console.log ) { console.log( "sample of data:", data ); } }); now wanted same angularjs did following first did this: var req = { method: 'get', url: "http://api.somesite.com/api?format=json", headers: { 'content-type': "application/json", }, } $http(req).then(function(response){ console.log(response.data); }); i in console: xmlhttprequest cannot load http://api.somesite.com/api?format=json. no 'access-control-allow-origin' header present on requested resource. origin 'http://localhost:8100' therefore not allowed access. then tried this: $http.jsonp('http://api.somesite.com/api?format=json',...