参看官网:http://vitalets.github.io/x-editable/docs.html#editable
$('#emailPassword').editable({
validate: function(value) {
if($.trim(value) == '') {
return '邮箱密码不能为空!';
}
if(!!!value.match(/^[a-zA-Z0-9_]{0,20}$/)){
return '邮箱密码只能是0-20位的拼音字母、数字或下划线组成';
}
},
success:function(response, newValue) {
if(response.success===1){
$("#emailPassword_hidden").val(newValue);
parent.messager(1, 0, '保存成功!', '');//提示
}else{
parent.messager(3, 0,'保存失败!', '');
}
},
params:function(params) {
params={"sysConfigVo.emailPassword":params.value,
"sysConfigVo.resourceId":$("#resourceId").val(),
"sysConfigVo.userId":$("#userId").val(),
"sysConfigVo.emailName":$("#emailName").val(),
"sysConfigVo.memo":$("#memo").val(),
"sysConfigVo.ext":$("#ext").val(),
"sysConfigVo.email":$("#email_hidden").val(),
"sysConfigVo.popServer":$("#popServer_hidden").val(),
"sysConfigVo.smtpServer":$("#smtpServer_hidden").val(),
};
return params;
},
url: '<%=baseURL %>/sysconfig/save.action',
});