The best way to send and process a list or Python object using JavaScript is to send JSON. You can use json.dumps in your python code
import json .... my_list = ['one', 'two', 'three', 'four'] self.response.write(json.dumps(my_list)
Now you get the JSON string. But with jQuery, it will give you a JavaScript object. See jQuery for more details: http://api.jquery.com/jQuery.getJSON/
If you are not using JSON, you can use the string to send the list:
my_list = ['one', 'two', 'three', 'four'] self.response.write(','.join(my_list))
source share