ajax提交表单进行页面刷新的方法
来源:爱站网时间:2022-12-21编辑:网友分享
有没有朋友想要了解下ajax提交表单进行页面刷新的方法内容的,那小编整理的这篇文章知识点绝对让你收获满满,想要了解一下的朋友千万不能错过了,以下内容很值得你们学习。
注:使用ajax 提交表单时 type类型最好不用submit 用button合适
|
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>
<div 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>
|
如果你没有看懂ajax提交表单进行页面刷新的方法,那就来网站找小编探讨下,我们每天都提供一些技术文章给大家阅读,让你们可以放心大胆的进行技术实操。