我试图从一个flask应用程序在HTML上打印一个字典,但它不允许我这样做,抛出下面的错误。我能够成功地返回字符串(https://github.com/upendrak/Disease_Predictor),但是当我更改代码以返回字典(下面的代码)时,它抛出了一个错误。我想这和我不太熟悉的js有关。在
这是我得到的错误
TypeError: 'list' object is not callable
The view function did not return a valid response. The return type must be a string, tuple, Response instance, or WSGI callable, but it was a list.
下面是我的app.py
脚本中的两个相关函数
这是我的js文件-https://github.com/upendrak/Disease_Predictor/blob/master/static/js/main.js
使用
[jsonify()][1]
传递数据。它将数据序列化为JSON,因此返回JSON响应。不要只返回return result
,而是执行return jsonify(result)
。在更新代码:
相关问题 更多 >
编程相关推荐