Been struggling with pset8 for a few days now. I've many problems here but I guess the main one is I'm not seeing my markers properly, not to mention that the infoWindow isn't happening... I've some basic problems with this pset as it's hard to understand what's responsible for what, which funcion cooperates with which other function(s) and so on. So this code might seem messy, sorry in advance. Any help towards the right direction would be much appreciated.
My addMarker code:
function addMarker(place)
{
var myLatlng = new google.maps.LatLng(42.3770, -71.1256); // Cambridge, Massachussets
var mapOptions = {
zoom: 8,
center: myLatlng
//mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map:map,
title:"Location"
});
// To add the marker to the map, call setMap();
marker.setMap(map);
// variable declaration for infoWindow
var content = '<ul>\n';
var query = place.place_name;
var parameters = {
geo: query
};
$.getJSON("articles", parameters)
.done(function(data, textStatus, jqXHR) {
// return data to content
for (var i = 0; i < data.length; i++)
{
content += data[i].title;
}
content += '</ul>';
})
.fail(function(jqXHR, textStatus, errorThrown) {
// log error to browser's console
console.log(errorThrown.toString());
});
}