layui form 表单提交 用 ajax提交
1
2
3
4
5
6
|
<form
class
=
"addvoteform layui-form"
>
<button
class
=
"layui-btn layui-btn-sm"
lay-submit lay-filter=
"formDemo2"
>确定</button>
</form>
|
1
|
form.
on
(
'submit(formDemo2)'
, function(data){
|
/* layer.msg(JSON.stringify(data.field)) */
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
$.ajax({
url:
"../Contestant/Employee.do"
,
async:
false
,
type:
"POST"
,
dataType:
"text"
,
data:data.field,
success: function(data){
if
($(
"#isphone"
).val()==0){
var
index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
}
else
{
window.history.go(-1);
}
}
})
return
false
;
});
|