1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
| $(document).ready(function() {
var tab = new Array('OES', 'PCT', 'MOB') ;
$.ajax({
type: "POST",
url : "traitement_geolocalisation_sfdf.php",
dataType: 'json',
success:function(data){
$.each(data, function(key){
var adresse = data[key].numk +" "+data[key].kernel+" , "+data[key].client_cp+ ", France";
var origine = data[key].origine ;
var Nb = data[key].Nb ;
var mon_image = "" ;
if(origine == "OnEShop"){
mon_image = "images/m2.png" ;
} else if(origine == "ServiceClients"){
mon_image = "images/m1.png" ;
} else if(origine == "MOB"){
mon_image = "images/m4.png" ;
}else {
mon_image = "images/m3.png" ;
}
$('#CarteFraude').gmap3(
{ action:'init',
options:{
center:[46.8,3],
zoom: 6,
mapTypeId: google.maps.MapTypeId.TERRAIN,
disableDefaultUI: true
}
},
{ action: 'getlatlng',
address: adresse,
callback: function(results){
// if ( !results ) return;
if (results ) {
$(this).gmap3({
action:'addMarker',
latLng:results[0].geometry.location,
marker:{
options: {
icon: new google.maps.MarkerImage(mon_image)
}
}
},
{
action:'addOverlay',
latLng: results[0].geometry.location,
options:{
content: '<div style="margin-left:-37px; width:50px; height: 20px; text-align:center"><b>'+Nb+'</b></div>',
offset:{
y:-32,
x:12
}
}
});
}
} // fin results
}
);
}); // fin data
},
error: function(jqXHR, textStatus, errorThrown){
alert(textStatus);
alert(errorThrown);
}
});
}); |
Partager