登录表单
1 <form onsubmit="return check_login()" style="text-align: center;margin-top:50px"> 2 <input value="登 录" class="btn_submit" id="btn_submit" type="submit"> 3 </form>
表单提交按钮和按钮失效款式
1 .btn_submit { 2 background-color: #e31436; 3 color: #fff; 4 cursor: pointer; 5 display: inline-block; 6 font-size: 18px; 7 height: 44px; 8 line-height: 44px; 9 text-align: center; 10 width: 200px; 11 border-radius: 2px; 12 border:none 13 } 14 .disabled{opacity: 0.5;cursor:default}
相干教程:ajax视频教程
表单提交考证
1 function check_login() { 2 if ($("#btn_submit").hasClass("disabled"));//防止反复提交 3 return false; 4 $("#btn_submit").addClass("disabled").val("正在提交"); 5 $.post("login.php", {id: 1}, function(data) { 6 $("#btn_submit").removeClass("disabled").val("登 录"); 7 location.href = "http://www.sucaihuo.com/php/2747.html"; 8 }, "json"); 9 return false; 10 }
相干教程:PHP视频教程
以上就是怎样用php+ajax完成用户登录按钮加载的细致内容,更多请关注ki4网别的相干文章!