I am trying to consume an api which responds with JSON. But I am getting this error: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource. However I am able to parse the same json locally.
function getData(lat,long) {
var url = "http://utilities- oyorooms.herokuapp.com/api/v2/search/hotels?filters[coordinates][longitude]=" + long + "&filters[coordinates][latitude]=" + lat + "&filters[coordinates][distance]=20&fields=name,longitude,latitude,oyo_id&access_token=MXB2cE44LWJGaTViWExHQ0xCOC06VUtucEhhVV9mclNNeWdrNFBveFY=&additional_fields=room_pricing";
$.getJSON(url, function( data ) {
$(data).each(function( key, val ) {
$.each(val.hotels , function(k , v ){
alert(v.distance);
});
});
});
}