I am building a project where it is up to the user to type in lat and long and I use that to convert into a google map as such:
<iframe width="100%" height="450" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/place?q=<?=$foo->getLocationLat()?>,<?=$foo->getLocationLong()?>&key=<?=$foo->getAPIKey"></iframe>
But obviously we will have issues where the lat long they type in won't be valid, and as a result the google map will fail, etc. Is there an elegant solution to determine if the map is correct prior to painting it to the screen? I would like to not have to pass the lat long into a method to determine if the address exists (this is the only way I can think of doing this).