I have a function in flask called array that takes in a list and prints out the items in the list:
def array(list):
string = ""
for x in list:
string+= x
return string
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?
for (var i = 0; i < response.data.length; i++) {
console.log(i);
// str = str + "<br/><b>Pic</b> : <img src='"+ response.data[i].picture +"'/>";
str[i] = response.data[i].picture;
}
window.location = "{{ url_for('array', str=list ) }}";
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…