I'm trying to use the Validation jQuery plugin with the flask framework. This is my code:
email: {
required: true,
email: true,
remote: {
url: $.getJSON($SCRIPT_ROOT + "/_check_mail"),
}
},
This request should get send to the servers that checks if the mail already exists in the database yes or no:
@app.route('/_check_mail')
def check_mail():
mail = request.args.get('email')
check = database.check_mail(mail)
return check
The check variable is "True" if the mail doesn't exists and holds the string "This mail already exists" If the mail already exists.
However, when I try to send this to the server I get this error message:
- Request URL:http://0.0.0.0:5000/[object%20Object]?email=arnoutaertgeerts%40gmail.com
- Request Method:GET
- Status Code:404 NOT FOUND
Already tried some other things but nothing worked. Any ideas?
I think I would be able to make it work with a costum method but then I need to do a synchronous AJAX request...
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…