I'm using the Google Maps API to build a map of store locations near a user-inputted location. Everything is working, but I'm getting an error in Internet Explorer I'd like to get rid of. The error is that "json.markers[i].latitude is null or not an object". Here's the code:
function buildGoogMapView(mrkrs,json)
{
var marker=centerLatitude=centerLongitude=startZoom=point=map="";
mrkrs.each(json.gdrcenter, function(i) {
centerLatitude = json.gdrcenter[i].latitude;
centerLongitude = json.gdrcenter[i].longitude;
});
mrkrs.each(json.gdrzoom, function(i) {
startZoom = json.gdrzoom[i].setting;
});
startZoom = Number(startZoom);
map = new GMap2(document.getElementById("mapGOOG_PlaceHolder"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(centerLatitude, centerLongitude),startZoom);
mrkrs.each(json.markers, function(i) {
point = new GLatLng(json.markers[i].latitude,json.markers[i].longitude);
marker = createMarker(point,json.markers[i].description);
map.addOverlay(marker);
});}
And here's the JSON object, as requested (I've changed some of the values for confidentiality purposes):
{"gdrzoom":[
{"setting":"7"}],
"gdrcenter":[
{"latitude":"35.5",
"longitude":"-79.6"}],
"markers":[
{"latitude":"35.0",
"longitude":"-78.9",
"name":"Store",
"description":"DESCVALUE"},
{"latitude":"36.0",
"longitude":"-79.8",
"name":"Store",
"description":"DESCVALUE"},
{"latitude":"35.5",
"longitude":"-80.8",
"name":"Store",
"description":"DESCVALUE"}]}
I'm not getting this error in any other browser, and I know that the json object contains the correct information. I've also moved the script to the end of the page to make sure it wasn't something as simple as that (it wasn't).
Any ideas?