This article mainly introduces the solution to quickly refresh the Ajax submission form page. Friends who need it can refer to it
Note: When using ajax to submit the form, it is best not to use submit for the type type. Use button. Appropriate
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | <form>
<p class= "col-md-9 col-sm-9 col-xs-12 col-md-offset-3" >
<input type= "button" class= "btn btn-info" value= "重置" onclick= "return resetaa()" >
<input type= "button" class= "btn btn-success" value= "提交" onclick= "return formCheck()" >
</form>
<script type= "text/JavaScript" >
function formCheck(){
$.ajax({
type: "post" ,
url:& #39;/fudaMes/orderInfo/insertOrderInfo',
data:$(& #39;#formId').serialize(),// 你的formid
async: true ,
error: function (request) {
new PNotify({
title: & #39;提交失败',
text: & #39;信息录入失败',
type: & #39;error',
styling: & #39;bootstrap3'
});
},
success: function (data) {
if (data== "success" ){
new PNotify({
title: & #39;提交成功',
text: & #39;订单信息已录入',
type: & #39;success',
styling: & #39;bootstrap3'
});
} else {
new PNotify({
title: & #39;提交失败',
text: & #39;信息录入失败',
type: & #39;error',
styling: & #39;bootstrap3'
});
}
}
});
}
</script>
|
Copy after login
The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.
Related articles:
Two solutions for Ajax opening a new window and being intercepted by the browser
Solution WeChat returns to the previous page, The AJAX request in the page is invalid for the Get request
ajax implements asynchronous file or image upload function
The above is the detailed content of Ajax submission form page refreshes quickly solution. For more information, please follow other related articles on the PHP Chinese website!