jquery mysql

wenwen1 发布于 2012/08/14 15:57
阅读 470
收藏 0

我想问一下我写了一个删除按钮,但是只能在当时的页面删除,等我再一次打开这个页面的时候删除的数据就出现了,这个该怎么办啊?

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>我的主页</title>
    <link rel="stylesheet" type="text/css" href="../jquery-easyui-1.2.5/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../jquery-easyui-1.2.5/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="../demo/demo.css">
    <script type="text/javascript" src="jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="jquery.easyui.min.js"></script>
    <script>
    $(function(){
          var lastIndex;
            $('#vender').datagrid({
                title:'供应商通讯录',
                iconCls:'icon-save',
                nowrap: false,
                striped: true,
                collapsible:true,
                url:'getVender.jsp',
                sortName: 'name',
                sortOrder: 'desc',
                fit:'true',
             fitColumns:'true',
                remoteSort: false,
                columns:[[
                    {title:'公司名称',field:'company',width:'fillsize(0.1)',align:'center',sortable:true,editor:'text'},
                    {title:'联系人',field:'name',width:'fillsize(0.1)'),align:'center',sortable:true,editor:'text'},
                    {title:'职位',field:'title',width:'fillsize(0.1)',align:'center',sortable:true,editor:'text'},
                    {title:'手机',field:'Mob',width:'fillsize(0.1)',align:'center',sortable:true,editor:'numberbox'},
                    {title:'电话',field:'phone',width:'fillsize(0.1)',align:'center',sortable:true,editor:'text'},
                    {title:'传真',field:'fax',width:'fillsize(0.1)',align:'center',sortable:true,editor:'text'},
                    {title:'邮箱',field:'mail',width:'fillsize(0.15)'),align:'center',sortable:true,editor:'text'},
                    {title:'国家',field:'country',width:'fillsize(0.05)',align:'center',sortable:true,editor:'text'},
                    {title:'省市',field:'province',width:'fillsize(0.05)',align:'center',sortable:true,editor:'text'},
                    {title:'城市',field:'city',width:'fillsize(0.05)',align:'center',sortable:true,editor:'text'},
                    {title:'公司地址',field:'company_address',width:'fillsize(0.2)',align:'center',sortable:true,editor:'text'}
                ]],
                pagination:true,
                rownumbers:true,
                toolbar:[{
                    id:'btnadd',
                    text:'新增供应商',
                    iconCls:'icon-add',
                    handler:function(){
                        $('#btnadd').linkbutton('enable');
                        $('#btnadd').blockUI({
                           url:"newVender1.html",//弹出窗口显示的内容,使用iframe
                           OKEvent:okEvent,//okEvent是自定义的确定按钮响应函数,
                           css:{width:"700",height:"500"}
                         });
                    }
                },'-',{text:'删除',
                    iconCls:'icon-remove',
                    handler:function DelAff(){
                    $.messager.confirm('确认','是否真的删除?',function(r){
                           if (r){
                           var selected = $('#vender').datagrid('getSelected');
                            if (selected){
                               var index = $('#vender').datagrid('getRowIndex', selected);
                               $('#vender').datagrid('deleteRow', index);
                             DeleteSubmit(selected);
                            }
                            }
                            });
                           }
                    }],
       
                    onClickRow:function(rowIndex){
                    if (lastIndex != rowIndex){
                        $('#vender').datagrid('endEdit', lastIndex);
                        $('#vender').datagrid('beginEdit', rowIndex);
                    }
                    lastIndex = rowIndex;
                }
            });
             function DeleteSubmit(selected)
   {
        var url="getVender.jsp?Id="+selected.ID;
        $.post("getVender.jsp");
   }
            var p = $('#vender').datagrid('getPager');
            $(p).pagination({
                onBeforeRefresh:function(){
                    alert('正在刷新');
                }
            });
        });       
    </script>
</head>
<body>
<table id="vender"></table>
</body>
</html>
加载中
返回顶部
顶部