views:

49

answers:

2

I am sending a tuple as my variable to javascript. But i could not find a way. I am using bottle framework.

+2  A: 

Encode it into JSON. It'll convert to a javascript array.

Oli
+2  A: 

A related tip to add to @Oil's point, Bottle returns JSON by default of you return a dict:

@route('/resource.json')
def resource_json():
    response = dict(
        data=('tuple', 'of', 'things'))
return response

See http://bottle.paws.de/page/docs#output-casting

Tim McNamara