Dear All,
I am not sure if this method of data retrieve is optimal.
I have used the method below first I use GDownloadUrl then in the
historyLocation.php I have encoded it as echo
json_encode(array("Locations"=>$points)); . The only problem when I
try to iterate now in the procssHistoryData it gives the error at this
line "if (json.Locations.length>0) { " saying that json.Locations is
undefined . Just to add on the alert("data : "+json); give me the
full data from my php page with out any problem. Thank you.
function createMap() {
var map = new GMap2(document.getElementById("map"));
var lat = 1.285496;
var lng = 103.809946;
var zoom = 14;
map.setCenter(new GLatLng(lat, lng), zoom);
getHistoryData()
}
function getHistoryData()
{
GDownloadUrl("historyLocation.php",
procssHistoryData,
"deviceID=12191&dateFrom=2010-08-01&timeFrom=00:00:00&dateTo=2010-08-03&timeFrom=00:00:00",
"application/x-www-form-urlencoded");
}
function procssHistoryData(json)
{
alert("data : "+json);
if (json.Locations.length>0) {
for (i=0; i<json.Locations.length; i++) {
var location = json.Locations[i];
alert("Location is : "+location);
}
}
}
--
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.