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();
}
});