This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head><title>Static Map Demo - client side</title> | |
<script src="http://code.jquery.com/jquery-1.4.2.min.js"></script> | |
<script type="text/javascript"> | |
function getData(){ | |
var str; var msg; | |
str= "http://maps.google.com/maps/api/staticmap?center=Dallas,Texas"; | |
str+="&zoom=10&size=512x512&maptype=roadmap"; | |
$.getJSON('dallas2.php', function(data) { | |
$.each(data, function(i,item){ | |
addr=item.block+" "+item.location; | |
label=String.fromCharCode(65+i); | |
str+="&markers=color:blue|label:"+label+"|"+encodeURIComponent(addr); | |
str+=encodeURIComponent(",Dallas,Texas"); | |
msg=label+" - "; | |
msg+=item.date_time+": "+item.nature_of_call; | |
msg+=", incident #"+item.incident_num; | |
msg+=", unit "+item.unit_num+" "+item.status; | |
msg+=" (priority "+item.priority+") - "+item.block+" "+item.location; | |
$("<li>").html(msg).appendTo("#details"); | |
}) | |
str+="&sensor=false"; | |
$("<img/>").attr("src", str).appendTo("#map"); | |
}); | |
} | |
</script> | |
</head><body onload="getData()"> | |
<div id="map"></div> | |
<ul id="details"></ul> | |
</body></html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment