📜  如何将信息从 javascript 发送到烧瓶路由 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:14.389000             🧑  作者: Mango

代码示例1
#python route
@app.route('/this-route', methods=['GET', 'POST']):
def thisRoute():
    information = request.data
    return "1"

#javascript
const URL = '/get-coordinates'
const xhr = new XMLHttpRequest();
sender = JSON.stringify([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
xhr.open('POST', URL);
xhr.send(sender);