Hello all,
I have a method which returns a list of customers with their geographical coordinates.The consists of customerName,latitude and longitude.My problem is on how to pass that object to a javascript function.
At first,i am hard coding the values in my javascript as shown
&
<pre lang="Javascript"><pre lang="Javascript">
lt;script type="text/javascript">
var locations = [
['Customer 1', 15.45534486191928, 18.72465389941408, 4],
['Customer 2', 15.443555941025974, 18.750574767334, 5],
];
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 10,
center: new google.maps.LatLng(1.2920659, 36.82194619999996),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var infowindow = new google.maps.InfoWindow();
var marker, i;
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map
});
google.maps.event.addListener(marker, 'click', (function (marker, i) {
return function () {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
}
</script>
Below is an object
List<customers> customer=getAllCustomers();
I need to pick the object customer and pass it to the javascript function without hardcoding it.How can i solve this?Tx