I have successfully added multiple markers to a Google map and now I want to add an info window to each marker. I've tried multiple ways with no luck.
What I would like if for an info window with the property_title
to popup when the marker is clicked on.
Here is what I have so far.
var data =
{ "property": [
{"property_id": 1, "property_title": "property 1", "property_img": "imag1", "longitude": 1234, "latitude": 1234, "width": 500, "height": 375},
{"property_id": 2, "property_title": "property 2", "property_img": "imag1", "longitude": 1234, "latitude": 1234, "width": 500, "height": 375},
{"property_id": 3, "property_title": "property 3", "property_img": "imag1", "longitude": 1234, "latitude": 1234, "width": 500, "height": 375},
{"property_id": 4, "property_title": "property 4", "property_img": "imag1", "longitude": 1234, "latitude": 1234, "width": 500, "height": 375},
{"property_id": 5, "property_title": "property 5", "property_img": "imag1", "longitude": 1234, "latitude": 1234, "width": 500, "height": 375}
]};
var markers = [];
for (var i = 0; i < 5; i++) {
var dataProperty = data.property[i];
var latLng = new google.maps.LatLng(dataProperty.latitude,
dataProperty.longitude);
var marker = new google.maps.Marker({
position: latLng
});
markers.push(marker);
}