提交表单

1.方式一 ,easyUI

<form id="fm" method="post" novalidate>
    <div class="fitem">
        <label>First Name:</label>
        <input name="firstname" class="easyui-validatebox" required="true">
    </div>
    <div class="fitem">
        <label>Last Name:</label>
        <input name="lastname" class="easyui-validatebox" required="true">
    </div>
    <div class="fitem">
        <label>Phone:</label>
        <input name="phone">
    </div>
    <div class="fitem">
        <label>Email:</label>
        <input name="email" class="easyui-validatebox" validType="email">
    </div>
</form>
form
$('#fm').form('submit',{
    url: url,
    onSubmit: function(){
        return $(this).form('validate');
    },
    success: function(result){
        var result = eval('('+result+')');
        if (result.success){
            $('#dlg').dialog('close');        // close the dialog
            $('#dg').datagrid('reload');    // reload the user data
        } else {
            $.messager.show({
                title: 'Error',
                msg: result.msg
            });
        }
    }
});
js

 

posted @ 2017-11-11 11:13  fight139  阅读(212)  评论(0编辑  收藏  举报