I'm struggling through the last pset! I managed to get the markers on the map, and got an info window working with just a placeholder in, (now removed) but now I'm stuck on getting the Ajax call for 'articles' to work. I'm getting an 'internal server error 500' and it seems to be the arguments I'm passing to the Ajax call, but I've tried every combination I can think of & I really can't make it work!!! I saw a question with the same problem, my 'articles' route also works when I use the suggested test, feeding in 'geo=' + a postal code, so I assumed that the parameters should be 'geo' and 'place.postal_code' as per the lat & long arguments I've used for the markers...am I missing something??! Any help would be very much appreciated! Here's my code (and I've just added the error msges too...):
/**
* Adds marker for place to map.
*/
function addMarker(place)
{var myLatLng = {lat:place.latitude, lng:place.longitude};
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
label: {
color: 'black',
text: place.place_name,
},
icon: {
labelOrigin: new google.maps.Point(11, 50),
url: 'https://maps.google.com/mapfiles/kml/pal2/icon5.png',
size: new google.maps.Size(30, 60),
origin: new google.maps.Point(0, 0),
anchor: new google.maps.Point(11, 40),
},
});
markers.push(marker);
var parameters = { geo:place.postal_code };
$.getJSON(Flask.url_for("articles"), parameters)
.done(function(data, textStatus, jqXHR){
//check if getJSON is working...
console.log(data);
//create ul of titles with links to add to div in showInfo as 'content'
//onclick
google.maps.event.addListener(marker, 'click', function(){
// call showInfo
showInfo(marker, content);
});
});
}