I am trying to get detailed information (hours of operation, phone number, website...) about an establishment via Google Places API. I am making the following $.ajax()
call, but am getting the error Uncaught SyntaxError: Unexpected token :
which is pointing to the formatting of the JSON response. The response looks good to me. I am able to see the json data correctly when I manually go to the URL: https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJq_FIY5UKhlQRF3Gj5h89erU&key=AIzaSyBy6GyaGufAa-XdQPkJZA6gGxIv8me31YI
$.ajax({
url: 'https://maps.googleapis.com/maps/api/place/details/json',
data: {
key: 'AIzaSyBy6GyaGufAa-XdQPkJZA6gGxIv8me31YI',
placeid: 'ChIJq_FIY5UKhlQRF3Gj5h89erU'
},
dataType: 'jsonp',
success: function(response) {
console.log('success', response);
}
});
// json response
{
"html_attributions" : [], // Uncaught SyntaxError: Unexpected token:
"result" : {
"address_components" : [
{
"long_name" : "182",
"short_name" : "182",
"types" : [ "subpremise" ]
},
{
"long_name" : "8180",
"short_name" : "8180",
"types" : [ "street_number" ]
},
...
]
}
}
What can I do to programmatically get the JSON data correctly?