Messages: 28

Enregistré le: 4 Aoû 2016

Message le Lun Oct 31, 2016 19:35

bonjour
s'ils vous plais google maps dans mon site ne s'affiche plus ,il m'affiche ( Oops! Something went wrong.
This page didn't load Google Maps correctly. See the JavaScript console for technical details)

voila mon code php:
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Multiple Markers Google Maps</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3.11&sensor=false" type="text/javascript"></script>
<script type="text/javascript">
<?php
$vd=html_entity_decode($villed);
$prd=html_entity_decode($prd);
$rdv= html_entity_decode($row['rdvdepart']);
$mapadress = $villed.', '.$prd.', '.$pd; // Your address
$prepAddr = str_replace(' ','+',$mapadress);
$geocode=file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$prepAddr.'&sensor=false');
$output= json_decode($geocode);
$lat = $output->results[0]->geometry->location->lat;
$long = $output->results[0]->geometry->location->lng;
?>
Haut
8 Réponses
Messages: 8448

Enregistré le: 14 Mai 2003

Message le Lun Oct 31, 2016 19:40

Et que dis la console comme suggéré par l'erreur ?
Haut
Messages: 28

Enregistré le: 4 Aoû 2016

Message le Lun Oct 31, 2016 20:10

js?client=AIzaSyDShRfKDPNxi0InoO5ntKIT6g4gWUQCSP4 &v=3.21&callback=initMap:95 You have included the Google Maps API multiple times on this page. This may cause unexpected errors.

Og @ js?client=AIzaSyDShRfKDPNxi0InoO5ntKIT6g4gWUQCSP4 &v=3.21&callback=initMap:95


js?client=AIzaSyDShRfKDPNxi0InoO5ntKIT6g4gWUQCSP4 &v=3.21&callback=initMap:35 Google Maps API error: InvalidClientIdMapError https://developers.google.com/maps/documentation/javascript/error-
messages#invalid-client-id-map-error_.bb @ js?client=AIzaSyDShRfKDPNxi0InoO5ntKIT6g4gWUQCSP4 &v=3.21&callback=initMap:35
util.js:221 Google Maps API warning: ClientIdLooksLikeKey https://developers.google.com/maps/documentation/javascript/error-mess ... ke-keyuD.S @ util.js:221
util.js:221 Google Maps API warning: RetiredVersion https://developers.google.com/maps/documentation/javascript/error-mess ... ed-version
Haut
Messages: 8448

Enregistré le: 14 Mai 2003

Message le Lun Oct 31, 2016 20:13

1) donc tu nous a pas montré tout ton code
2) les erreurs sont assez explicites
Haut
Messages: 28

Enregistré le: 4 Aoû 2016

Message le Lun Oct 31, 2016 20:17

voila tout mon code pour le map:


<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Multiple Markers Google Maps</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>

<script src="https://maps.googleapis.com/maps/api/js?v=3.11&sensor=false" type="text/javascript"></script>
<script type="text/javascript">
<?php
$va=html_entity_decode($villea);
$pra=html_entity_decode($pra);
$chut= html_entity_decode($row['chuttearrivee']);
$mapadress = $villea.', '.$pra.', '.$pa; // Your address
$prepAddr = str_replace(' ','+',$mapadress);
$geocode=file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$prepAddr.'&sensor=false');
$output= json_decode($geocode);
$lat = $output->results[0]->geometry->location->lat;
$long = $output->results[0]->geometry->location->lng;

?>
// check DOM Ready
$(document).ready(function() {
// execute
(function() {
// map options
var lat= <?php echo $lat; ?>;
var long=<?php echo $long; ?>;
var options = {
zoom: 15,
panControl:true,
zoomControl:true,
mapTypeControl:true,
scaleControl:true,
streetViewControl:true,
overviewMapControl:true,
rotateControl:true,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: new google.maps.LatLng(lat, long), // centered US
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: false
};

// init map
var map = new google.maps.Map(document.getElementById('map_arrivee'), options);

// NY and CA sample Lat / Lng
var southWest = new google.maps.LatLng(lat, long);
var northEast = new google.maps.LatLng(34.052234, -118.243685);
var lngSpan = northEast.lng() - southWest.lng();
var latSpan = northEast.lat() - southWest.lat();

// set multiple marker
for (var i = 0; i < 1; i++) {
// init markers
var marker = new google.maps.Marker({
position: new google.maps.LatLng(southWest.lat(), southWest.lng()),
map: map,
title: 'Point d arrivee '
});

// process multiple info windows
(function(marker, i) {
// add click event
google.maps.event.addListener(marker, 'click', function() {
infowindow = new google.maps.InfoWindow({
content: '<?php echo $mapadress;?>'
});
infowindow.open(map, marker);
});
})(marker, i);
}
})();
});
</script>
</head>
<body>
<div id="map_arrivee" style="height:150px;"></div>
</body>
</html>
Haut
Messages: 28

Enregistré le: 4 Aoû 2016

Message le Lun Oct 31, 2016 20:45

pas de solution ?
Haut
Messages: 8448

Enregistré le: 14 Mai 2003

Message le Lun Oct 31, 2016 20:54

Corriger les erreurs explicites de la console, indiquer la clef de l'API (depuis peu il en faut une).
Haut
Messages: 28

Enregistré le: 4 Aoû 2016

Message le Lun Oct 31, 2016 20:56

ou je met le clé api j'ai un clé mais j'ai pas compris ou je le met
Haut
Messages: 8448

Enregistré le: 14 Mai 2003

Message le Lun Oct 31, 2016 21:08

https://developers.google.com/maps/documentation/javascript/tutorial?hl=fr
Haut