I am trying to load Google API dynamically using getScript() method for "Place Autocomplete Address Form". ( https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-addressform )
Here's the code I came up with:
$.getScript( 'https://maps.googleapis.com/maps/api/js?sensor=false&libraries=places', function( data, textStatus, jqxhr ) {
console.log( data ); // Data returned
console.log( textStatus ); // Success
console.log( jqxhr.status ); // 200
console.log( "Load was performed." );
});
But I'm getting the following error message form my console:
ReferenceError: Can't find variable: google
undefined
success
200
Load was performed.
Any idea on how to fix that?