<! DOCTYPE html>
<meta charset= "UTF-8" >
<title>get</title>
<script type= "Text/javascript" src= "Js/jquery-1.10.1.min.js" ></script>
<body>
<!--Both methods can be changed to get--
<!--submission Method method= "POST"--
<form name= "Reg" action= "handle.php" method= "POST" >
User name: <input type= "text" name= "username"/>
Password: <input type= "password" name= "pwd"/>
<input type= "Submit" value= "Submission"/>
<a href= "javascript:void (0)" id= "submitbtn" > Submit </a>
</form>
<script type= "Text/javascript" >
Set Username&&password must be entered at the same time to submit
$ ("form"). On ("Submit", function (e) {
if ($ ("input[name= ' username ')"). val () = = "" | | $ ("input[name= ' pwd ']"). val () = = "") {
E.preventdefault ();
}
})
Submission Method Two Jquert Ajax
$ ("#submitBtn"). On ("click", Function () {
$.ajax ({
Type: "POST",
URL: "handle.php",
data:{
username:$ ("Input[name= ' username ']"). Val (),
pwd:$ ("Input[name= ' pwd ']"). Val ()
},
Success:function (Result) {
Console.log (result);
Window.location.href = "handle.php";
}
})
})
</script>
</body>
JQuery Post Submission (AJAX)