My problem is with the function addMarker in scripts.js
This is what I have:
function addMarker(place)
{
var myLatLng = {lat: place.latitude, lng: place.longitude};
var geo = place.postal_code
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
title: place.place_name
});
//Event listener
google.maps.event.addListener(marker, 'click', function(){
var content = $.getJSON("/articles", {geo: place.postal_code})
showInfo(marker, content);
})
markers.push(marker);
}
What I'm getting back is a map that the markers show up but when clicked the markers don't have articles the text is just: [object Object]
Doesn't make much sense. I barely understand the javascript, I'm not sure exactly what I'm doing with the $.getJSON other than the fact that I'm somehow doing the opposite of the articles(): function in application.py.
Am I supposed to somehow modify what I'm getting back as content from $.getJSON? If so how?
Is my js syntactically correct?
How can I fix this?