Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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 ) }}";
share|improve this question
I'm kind of clueless in this area but this might help you. stackoverflow.com/questions/15537254/… – Shashank Gupta 31 mins ago
you'd like for list to be transformed into a query string and appended to the URL there in the last line? – JAL 19 mins ago

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.