Home >Backend Development >PHP Tutorial >Ajax submission form page refreshes quickly with examples
This article mainly introduces the solution to how to refresh the Ajax submission form page quickly. Friends who need it can refer to it. I hope it can help everyone.
Note: When using ajax to submit a form, it is best not to use submit but to use button instead.
<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:'/fudaMes/orderInfo/insertOrderInfo', data:$('#formId').serialize(),// 你的formid async: true, error: function(request) { new PNotify({ title: '提交失败', text: '信息录入失败', type: 'error', styling: 'bootstrap3' }); }, success: function(data) { if(data=="success"){ new PNotify({ title: '提交成功', text: '订单信息已录入', type: 'success', styling: 'bootstrap3' }); }else{ new PNotify({ title: '提交失败', text: '信息录入失败', type: 'error', styling: 'bootstrap3' }); } } }); } </script>
Related recommendations:
Summary of JS page refresh methods
Several ways to refresh the page using javascript
The above is the detailed content of Ajax submission form page refreshes quickly with examples. For more information, please follow other related articles on the PHP Chinese website!