我想要做的是通过 AJAX 将 Python 中函数的结果返回给我的 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)
BIG阳
慕哥6287543
相关分类