Initially, my intention was to utilize jQuery for this task, but due to restrictions with the Google Places API regarding JSONP requests, I am resorting to using a standard XMLHttpRequest instead:
function load() {
var req = new XMLHttpRequest();
req.open('GET', 'https://maps.googleapis.com/maps/api/place/details/json?reference=CnRhAAAARMUGgu2CeASdhvnbS40Y5y5wwMIqXKfL-n90TSsPvtkdYinuMQfA2gZTjFGuQ85AMx8HTV7axABS7XQgFKyzudGd7JgAeY0iFAUsG5Up64R5LviFkKMMAc2yhrZ1lTh9GqcYCOhfk2b7k8RPGAaPxBIQDRhqoKjsWjPJhSb_6u2tIxoUsGJsEjYhdRiKIo6eow2CQFw5W58&sensor=true&key=xxxxxxxxxxxxx', false);
req.send(null);
if (req.status == 200) {
dump(req.responseText);
}
}
I'm currently facing challenges with cross-domain security issues. Nevertheless, my main query is whether this method is the simplest way to request JSON data from the Google Places API?
I am seeking a straightforward approach that doesn't necessitate setting up a local proxy to handle cross-origin concerns.
Alternatively, are there other JavaScript toolkits available that facilitate regular JSON requests?