Hi guys.
I need some help regarding jquery arrays.
var queryArr;
$(markersArray).each(function(index) {
var _locationId = index;
var _locName = markersArray[index].name;
var _markerLat = markersArray[index].marker.getLatLng().lat();
var _markerLng = markersArray[index].marker.getLatLng().lng();
//I DO NOT KNOW THE SYNTAX BELOW HELP IN HERE PLEASE..
var locations = {
locationId:_locationId;
locationName:_locName,
lat:_markerLat,
lng:_markerLng }
queryStr = { "locations": locations} //??????????
});
queryArr.push(location); //???????
}
I need to reach each element by using sth like this:
alert(queryArr[0].locations.locationId);
Obviously I will be using a for loop to reach each data by an index.
Can anyone give me example syntax for this.. I have found plenty examples of fixed arrays but not dynamic content.