I'm not sure where exactly you added the markers in your code, but I find the instructions clear about what addMarker
is supposed to do.
Implement addMarker
in scripts.js
in such a way that it adds a marker
for place
on the map, where place
is a JavaScript object that
represents a row from places
, your MySQL table.
see addMarker
for more!
so if you were able to write code that adds markers to the map and customize them, that's great except that you want addMarker
to be the method that is responsible for adding a marker that represents a single place on the map then use it to add all the markers you want (one by one).
Does addMarker
have to pass the output from articles.php
to showInfo
?
not exactly! add marker should make each marker it adds listen for mouse clicks such that if a marker is clicked, showInfo
is called with the appropriate arguments in order to show a window containing a spinning icon, an unordered list of articles, or maybe an info message in case there are no articles to show for this location.
see showInfo
for more!
I'd love some advice on the syntax for the listener event and/or
showInfo
call.
if I have a marker called marker
, I may listen for clicks on it as follows:
marker.addListener('click', function() {
// do something
});
see Events for more info!