Im new to Flask . I try a user log-in page I validate the user input by jQuery code:
$(document).ready(function(){
//alert('begin');
$(".input.reg_butn").click(function(){
if($("[name=username]").val()==""){
alert("username empty");
}else{
if($("[name=password]").val()==""){
alert("password empty");
}
}
})
})
and my python code is as follow:
@app.route('/login',methods=['GET','POST'])
def login(): .....
My question is how to stop python code running when the js find that the user submit an invalid value(such as empty username of password). I user alert in JS to notify the user , BUT the python code run as usual. How to solve it ?
Aucun commentaire:
Enregistrer un commentaire