0

There is this list data stores that has elements that looks like this.

[ [...],[23349, 'storeName', "['0285434668']", 'open', [], 35.2132, 129.046],[...] ]

I can pass the list as in return render_template("geo.html", stores=stores) but I'm not sure how I can access this as a list data in javascript so that I can use it as below.

        var i;         
        for(i = 0; i < 5; i++){
          var marker = new google.maps.Marker({position: {lat: parseFloat(stores[i][5]), lng: parseFloat(stores[i][6])}, map: map});
        }

On the server side, I use python and flask.

  • Possible duplicate of [How can I pass data from Flask to JavaScript in a template?](https://stackoverflow.com/questions/11178426/how-can-i-pass-data-from-flask-to-javascript-in-a-template) – Dušan Maďar Dec 07 '18 at 15:51
  • @DušanMaďar I actually read that post before posting, but probably because I messed up some part, all those answers including json didn't work. But {{}} it self actually worked, and though what I wanted was having a 'list' data in javascript, {{}} will be a good way to get around it. Thanks. – PuffedRiceCrackers Dec 07 '18 at 16:01

1 Answers1

0

You can do this with JavaScript Array map()