I'm almost done with pset8 but the update function in scripts.js is not working.
This happens when I use the text box to search a place:
[24/Apr/2017 02:27:35] "GET /update?ne=NaN%2CNaN&q=&sw=NaN%2CNaN HTTP/1.1" 500 raise RuntimeError("invalid sw")
The maps neves loads.
When I simply drag to search other places It works perfectly.
function update()
{
// get map's bounds
var bounds = map.getBounds();
var ne = bounds.getNorthEast();
var sw = bounds.getSouthWest();
console.log(sw);
// get places within bounds (asynchronously)
var parameters = {
ne: ne.lat() + "," + ne.lng(),
q: $("#q").val(),
sw: sw.lat() + "," + sw.lng()
};
$.getJSON(Flask.url_for("update"), parameters)
.done(function(data, textStatus, jqXHR) {
// remove old markers from map
removeMarkers();
// add new markers to map
for (var i = 0; i < data.length; i++)
{
addMarker(data[i]);
}
})
.fail(function(jqXHR, textStatus, errorThrown) {
// log error to browser's console
console.log(errorThrown.toString());
});
}