jQuery .get()不向服务器发送请求

时间:2019-09-02 23:15:03

标签: javascript python jquery flask

application.py:

7. Install the latest versions of Python

8. As Admin:
$ cd "C:\Program Files\nodejs\node_modules\npm"
$ npm install node-gyp

9. $ npm config set msvs_version 2015 --global

Note: that I have VS 2017, but configuring it as ver 2017 won't work. Not sure why.

    10. As Admin:
$ npm install -g node-sass

And finally, one last check:
$ node-sass -v

index.html

from flask import Flask, render_template

app = Flask(__name__)

@app.route("/")
def index():

    return render_template("index.html")

@app.route("/check", methods=["GET", "POST"])
def check():

    print("receiving a request")

    return "False"

我的问题位于脚本标签内。

当我单击密码文本框以触发模糊功能时,警报将起作用,但不会从jQuery .get()发出请求。注释掉的Ajax代码将可以调用check函数。

所以我想知道能够使用.get()是什么?

感谢您阅读。

1 个答案:

答案 0 :(得分:0)

当我运行代码时,它会显示在浏览器$.get is not a function的控制台中。

当我使用Google查找此文本时,我发现query slim没有此功能,您必须使用普通版本,而不是苗条。

<script src="https://code.jquery.com/jquery-3.3.1.min.js" crossorigin="anonymous"></script>

使用此版本后,我可以看到receiving a request