1
I have this function that receives the variables and assembles the map. It simply stopped working and on the console appears the error
--- index.php:196 Uncaught Referenceerror: $ is not defined
--- $('#modalMapa'). modal('show'). on('Shown.bs.modal', Function(){*
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="bootstrap/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<script src="js/geturi.js"></script>
<script src="js/jquery.js"></script>
<script src="https://maps.google.com/maps/api/js?key=AIzaSyC7XYX6dcQmlOcBSuJXVFRRsLkHz8WcruY"></script>
<script src="js/gmaps.js"></script>
<title></title>
<script type="text/javascript">
function chamaModalMapa(latitude,longitude,cliente){
var map;
$('#modalMapa').modal('show').on('shown.bs.modal', function(){
map = new GMaps({
div: '#map',
center:{
lat: latitude,
lng: longitude
},
zoom: 18,
scrollwheel: false,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU,
position: google.maps.ControlPosition.TOP_RIGHT
},
styles: [{
"featureType": "poi",
"stylers": [
{ "visibility": "off" }]
}]
});
map.addMarker({
lat: latitude,
lng: longitude,
infoWindow: {
content: '<div style="padding-top:8px;color:#333;"><p>'+cliente+'</p></div>'
},
animation: google.maps.Animation.DROP,
});
var markerInstance = map.markers[0];
markerInstance.infoWindow.open(map, markerInstance);
});
};
</script>
</head>
<body>
<!-- CONTEUDO -->
<div class="modal fade" id="modalMapa" tabindex="-1" role="dialog" aria-labelledby="edit" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>
<h4 class="modal-title custom_align" id="Heading">Local de Entrega</h4>
</div>
<div class="modal-body">
<div id="map" style="width: 100%;height: 350px;">
</div>
<div class="modal-footer ">
<button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove"></span> Fechar</button>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
Um, swap the $ for Jquery and tell me if anything has changed.
– Bsalvo
--- Jquery('#modalMapa'). modal('show'). on('Shown.bs.modal', Function(){*
– Bsalvo
From the bug it seems that you are not loading Jquery, put the Jquery reference in the document.
– Laércio Lopes
@BS target now appears index.php:63 Uncaught Referenceerror: jquery is not defined
– Ezequiel Tavares
I believe Laércio is right. You use Jquery via link? if that is the case your link may no longer exist. http://code.jquery.com/ Here you get the most suitable version.
– Bsalvo
I edited the question @Laérciolopes
– Ezequiel Tavares
Beauty, the
geturi.js
has codeJQuery
? some variable starts with$
? If you have to reference him after thejquery.js
.– Laércio Lopes
@Laérciolopes yes geturi.js has a lower function that uses it but via javascript.
– Ezequiel Tavares