when i access the value from my json data in google map api and adding marker with the help of MarkerWithLabel, labelContent:building.Post-completion. but when I running this code, it says,ReferenceError: completion is not defined,but my json data have following type. I think there is a issue regarding the - character in Post-completion,which cannot read a single sentence.but there is a value associated with it.
var activity_status = [{"Completion": 0, "Pipeline": 0, "Implementation": 5, "country": "MYANMAR", "Post-completion": 138, "Cancelled": 0},
{"Completion": 0, "Pipeline": 0, "Implementation": 0, "country": "Bahrain", "Post-completion": 0, "Cancelled": 0},
{"Completion": 0, "Pipeline": 0, "Implementation": 0, "country": "ZIMBABWE", "Post-completion": 1, "Cancelled": 0},
{"Completion": 0, "Pipeline": 0, "Implementation": 12, "country": "MONGOLIA", "Post-completion": 34, "Cancelled": 0},{}];
for(var j= 0; j < activity_status.length; j++) {
(function(i) {
var building = activity_status[i];
geocoder.geocode({'address':building.country}, function(results,status){
if(status == google.maps.GeocoderStatus.OK){
var marker = new MarkerWithLabel({
position:new google.maps.LatLng(results[0].geometry.location.lat(),results[0].geometry.location.lng()),
title:building.country,
map:map,
labelContent:building.Post-completion,
labelAnchor:new google.maps.Point(6,22),
labelClass:"labels",
labelInBackground:false,
icon:"circle2.png"
});
console.log(building.country)
}
else{
console.log("Geocode was not succcessful for the following reason:" + status);
}
});
})(j);