I have a web application,based on MVC, where the object "myMap" is a Map<integer,object> that i populate into Controller and i pass to the View. How can i parse it?
When i run application, i can see this in the view:
<pre lang="Javascript">
var myMap ={0:{'cellId':'15064','creationTime':null,'date':'20120528','direction':'O','id':null,'localAreaCode':'20016','modificationTime':null,'receiver':'URkatij09Kce/Qj0vnEr8s','sender':'VdzW4Vvb7IcjURYCGBs.Is','siteName':'NAVIGLIO PAVESE','time':'222932','version':0},
1:{'cellId':'15064','creationTime':null,'date':'20120528','direction':'O','id':null,'localAreaCode':'20016','modificationTime':null,'receiver':'URkatij09Kce/Qj0vnEr8s','sender':'VdzW4Vvb7IcjURYCGBs.Is','siteName':'CERMENATE','time':'222932','version':0}};
</pre>
How can i get values associated to a key? (for example SiteName value for every key) Thank you
What I have tried:
for (var m in myMap){
for (var i=0;i<myMap[m].length;i++){
geocoder.geocode({'address': myMap[m][i]}, function(results, status) {
if (status === 'OK') {
resultsMap.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: resultsMap,
position: results[0].geometry.location
});
} else {
alert('Geocode was not successful for the following reason: ' + status);
}
});
}
}