我想要做的是通過 AJAX 將 Python 中函數(shù)的結果返回給我的 javascript。目前,我在期待“真”或“假”時收到此響應查詢: var test = $.getJSON("/chk_chn", { name: channel_name }); alert(test.toSource())Python:@app.route("/chk_chn")def chk_chn_unique():"""Checks a name against all existing Channels in a Channel List. Returns True if name is unique, False otherwise"""name = request.args.get("name")for channel in Channels: if channel.get_name() == name: return jsonify(result=False)return jsonify(result=True)
添加回答
舉報
0/150
提交
取消