I am using AngularJS $http for sending HTTP Get Request.
$http({
method: 'get',
url: 'http://cross-domain-url/api/v1/service1',
params : {'key1' : 'value1'},
data:'',
headers : {'Accept': 'application/JSON',
'Content-Type' : 'application/JSON'},
cache : false
}).then(function (response) {
$waitDialog.hide();
return response;
});
But this results in following error "Origin localhost is not allowed by Access-Control-Allow-Origin."
But when I am changing method to JSONP I am getting the correct response but that response is in XML. As content-type cannot be set using JSONP and that API by default use application/xml type. Is there any way I can request data from third party API that returns data in XML. ?
P.S: As the third party is controlled by someone else so I cant change default response type of data.