如何将变量发送到javascript?

如何将变量发送到javascript?,javascript,python,bottle,Javascript,Python,Bottle,我将一个元组作为变量发送到javascript。但我找不到办法。我正在使用瓶子框架。。它将转换为javascript数组。。它将转换为javascript数组。要添加到@Oil's point的相关提示,瓶子会返回JSON,默认情况下,您会返回一个dict: @route('/resource.json') def resource_json(): response = dict( data=('tuple', 'of', 'things')) return respon

我将一个元组作为变量发送到javascript。但我找不到办法。我正在使用瓶子框架。

。它将转换为javascript数组。

。它将转换为javascript数组。

要添加到@Oil's point的相关提示,瓶子会返回JSON,默认情况下,您会返回一个dict:

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

请参阅添加到@Oil's point的相关提示,默认情况下,瓶子返回JSON,您将返回dict:

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