           }, 'json');
        });
    }

    // 确认保存
    function save(flag){
        if (flag == 'edit') {
            var selRow = $('#listdata').datagrid('getSelected');
            var url = '/brand/edit?id=' + selRow.id;
            var form = 'editForm';
        } else if (flag == 'add') {
            var url = '/brand/add';
            var form = 'addForm';
        }


        $('#' + form).form({
            url: url,
            onSubmit:function(){
                return $(this).form('ena