title: Passing Javascript Array to Flask
body: <p>I have a function in flask called array that takes in a list and prints out the items in the list:</p>
  
  <pre><code>def array(list):
      string = ""
      for x in list:
          string+= x
      return string
  </code></pre>
  
  <p>On the client side, I want to pass in a javascript array named str into this array. How would I do that? Here's what I have right now, but Flask isn't reading the added variable. Any ideas?</p>
  
  <pre><code>for (var i = 0; i &lt; response.data.length; i++) {
              console.log(i);
  
              // str = str + "&lt;br/&gt;&lt;b&gt;Pic&lt;/b&gt; : &lt;img src='"+ response.data[i].picture +"'/&gt;";
  
              str[i] = response.data[i].picture;
          }
          window.location = "{{ url_for('array', str=list ) }}";
  </code></pre>