其他分享
首页 > 其他分享> > layui表单提交封装

layui表单提交封装

作者:互联网

 

/**
* 表单提交
* @param formId
* @param submitForm_success
* @return
*/
function submitForm(formId,submitForm_success){
layui.use('form', function(){
var form = layui.form;
//监听提交  ajaxSubmit.js支持
form.on('submit(formSubmit)', function(data){
$(formId).ajaxSubmit({
type:'post',
success:submitForm_success
});
return false;
});
});
}

submitForm("#addform",function(data){
data = JSON.parse(data);
parent.layer.msg(data.msg);
if(data.result=="success"){
parent.loadCount();
closeIframe();
}
});

标签:submitForm,function,封装,form,success,layui,表单,formId,data
来源: https://www.cnblogs.com/java-llp/p/11393549.html