No 'Access-Control-Allow-Origin' header is present on the requested resource—when trying to get data from a REST API (cors)
const proxyurl = "https://cors-anywhere.herokuapp.com/";
const url = "https://maps.googleapis.com/maps/api/distancematrix/json?
units=imperial&origins=" + this.lat + "," + this.lng +
"&destinations=" + ulat + "," + ulang +
"&key=AIzaSyC0EvE5yeQM9DTxda79iEn_nd33kh6Y6Hg";
// site that doesn’t send Access-Control-*
let gapi=proxyurl + url;
Comments
Post a Comment