Can anyone tell me what I'm doing wrong? It seems to still not even work even for any of the console commands to check, so apparently my getJSON is not working.

function addMarker(place)       

    $.getJSON(Flask.url_for("articles"),{geo: place.postal_code})  
         console.log("Test Success");

        var coordinates = {lat: parseFloat(place.latitude), lng: parseFloat(place.longitude)};

        markers = new google.maps.Marker({
            position : coordinates,
            map: map

        markers.addListener('click', function() {
            showInfo(marker, news.title)                  //when there's a click in the marker open the info


Really would appreciate any tips into where I'm going wrong. thanks



def articles():
    """Look up articles for geo."""

    if not request.args.get("geo"):
        raise RuntimeError("missing geo")

    geo = request.args.get("geo")

    a = lookup(geo)  

    return jsonify(a[:5])    #getting just 5 objects
  • When I use this addMarker function in my scripts.js it does display "Test Success" in the console and puts markers on the map. Perhaps logging place.postal_code before the getJSON call, and then testing what articles returns for ../articles?geo= that result? There are a couple of other problems in the function, but you need to conquer this first. Feb 23 '17 at 13:48
  • Very strange, yeah the article function it's working well. I'm gonna update the OP and put that function just in case.
    – tadm123
    Feb 23 '17 at 23:02
  • And yeah @DinoCoderSaurus i also tried putting it before but i got the same results
    – tadm123
    Feb 23 '17 at 23:19
  • 1
    If you added a console.log at the very beginning of the function and you don't see it, then it's not getting to the function. Are latitude and longitude created as TEXT in the database? They need to be NUMERIC. That would cause the program to fail somewhere else (not really sure where) and never execute the addMarker function. That's the only way I can repro this problem. Feb 24 '17 at 2:10
  • Yeah I believe they are TEXT that's why I'm using parseFloat to convert them. I'll try changing it to INTEGER
    – tadm123
    Feb 24 '17 at 8:17

You must log in to answer this question.

Browse other questions tagged .