Home > Article > Web Front-end > Ajax submission form page refreshes quickly solution
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
<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>
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
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!