Skip to content

Instantly share code, notes, and snippets.

/scripts.js Secret

Created May 13, 2017
Embed
What would you like to do?
scripts.js - shared from CS50 IDE
/**
* Adds marker for place to map.
*/
function addMarker(place)
{
var url = 'https://ide50-chriswolfdesign.cs50.io/articles?geo=' + place.postal_code;
var json_data = $.getJSON(url);
var content = $.parseJSON(json_data);
// Temporary info window for testing
var infoWindow = new google.maps.InfoWindow({
content: content
});
// Instantiate the marker
var marker = new google.maps.Marker({
position: {lat: place.latitude, lng: place.longitude},
map: map
});
// Listen for clicks on the marker
marker.addListener('click', function() {
infoWindow.open(map, marker);
});
// Get articles for place
// Build a list of links to articles
// Add marker to our markers list
// markers.append(marker);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment