I would like to call the Google Maps Geocoding API using a Promise like this:
function makeGeoCodingRequest(address,bounds)
{
/*
Input parameters
If you want your code to wait until the asynchronous action is completed before continuing (BAD IDEA - the page will freeze while the request is completing) then add async: false
to the ajax request's parameters.
My recommendation, though, is to have makeGeoCodingRequest
return nothing directly - and simply give it an extra argument, requestCallback
so that its caller can pass in a function that will be called when the data is available. Call that function, with the resulting data, inside of your promise.then
function.