I have a system that currently works with google maps api, but I noticed that the site waits for this API to load and then finish loading the page.
on the homepage (index.php) I have the tag like this:
<!DOCTYPE html>
<html>
...
.
.
.
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>...</html>
Idonotusegooglemapsinindex.php,itisonlydonethiswaybecauseafterthepageisloadedtheuserclicksabuttonthatmakesaloadtoloadthemaplikethis:
$("#conteudo").load('veiculoDescarga.php');
When this google script script is placed within this file, the vehicle does not work. The api does not load its other dependencies.
// quando executo qualquer coisa da API tipo esse exemplo
new google.maps.DirectionsRenderer();
//Tenho essa mensagem de erro
TypeError: google.maps.DirectionsRenderer is not a constructor
//outro exemplo
google.maps.event.addDomListener(window, 'load', initialize);
//outro erro exemplo
TypeError: google.maps.event is undefined
Does anyone know if it is possible to make this API work after doing $ .load () or onload?
Edit 01 To illustrate better I will leave the images below with the explanations:
In the image below the googleapis tag is usually check that this single tag makes the call by searching for the other dependency tags and inserted them, this case is ok.
ButIdonotwantittoloadthereatfirst,IwantittoloadthatgoogleapistagwhenIcallthejQuery.load()event,butseethatwhenIdothisthetagloadsbutdoesnotdothecallotherdependencies