$("form").on('submit',function () {
})
當(dāng)一個(gè)form表單 的submit按鈕上苍息,同時(shí)有action和js的話缩幸,會(huì)先執(zhí)行js壹置,如果在js末尾寫上:
return false;
則不執(zhí)行action的路由;
success:function(res){
if(1){
layer.alert(res.msg,{icon:1},function () {
window.location.href = res.url;
})
}
//這里利用form.render 重新渲染下面的表單
}
$("form").on('submit',function () {
$.ajax({
url:this.action,
type:'post',
data:$(this).serialize(),
dataType:"json",
success:function (res) {
console.log(res);
}
})
})