2020-09-29

Getting a Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response

I'm currently a testing an API from Google which uses geocoding that returns an object containing the details of the coordinates. I keep getting this error on my site and unsure how to debug it

Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response

function getLocation() {

    $.ajax({
        url: 'https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&key=API-KEY',   
        type: "GET",   
        dataType: 'json',
        contentType: "application/json",
        success: function(result){
            console.log(result);
        }
    })
}



getLocation();


from Recent Questions - Stack Overflow https://ift.tt/2Sa5dH7
https://ift.tt/eA8V8J

No comments:

Post a Comment