1.form
<form id="ff" method="post"> <div> <label for="name">Name:</label> <input class="easyui-validatebox" type="text" name="name" data-options="required:true" /> </div> <div> <label for="email">Email:</label> <input class="easyui-validatebox" type="text" name="email" data-options="validType:'email'" /> </div> ... </form>
2.js
让表单(form)成为 ajax 提交的表单(form)
$('#ff').form({
url:...,
onSubmit: function(){
// do some check
// return false to prevent submit;
return $(this).form('validate');
},
success:function(data){
alert(data)
}
});
// submit the form
$('#ff').submit();
去做一个提交动作
// call 'submit' method of form plugin to submit the form $('#ff').form('submit', { url:..., onSubmit: function(){ // do some check // return false to prevent submit; }, success:function(data){ alert(data) } });
通过额外的参数提交
$('#ff').form('submit', { url:..., onSubmit: function(param){ param.p1 = 'value1'; param.p2 = 'value2'; } });
http://www.jeasyui.net/plugins/166.html