贷款管理系统ajax显示
2021-01-23 19:12
                         标签:conf   min   编号   next   jquer   result   query   else   ext3      贷款管理系统ajax显示 标签:conf   min   编号   next   jquer   result   query   else   ext3    原文地址:https://www.cnblogs.com/XiaoMa-/p/13277417.html 1 public ActionResult Show()
 2         {
 3             return View();
 4         }
 5         public ActionResult Add()
 6         {
 7             return View();
 8         }
 9         public ActionResult Del()
10         {
11             return View();
12         }
13         public ActionResult Upd(int id)
14         {
15             ViewBag.Sid = id;
16             return View();
17         }
18         public ActionResult Getfan()
19         {
20             return View();
21         }
22         public ActionResult Login()
23         {
24             return View();
25         }
@{
    ViewBag.Title = "Show";
}
h2>Showh2>
script src="~/Scripts/jquery-3.3.1.js">script>
script src="~/Scripts/jquery.unobtrusive-ajax.min.js">script>
div>
    input id="txt_Name" type="text" />input id="Button1" type="button" value="查询" onclick="Show(‘first‘);" />
div>
table id="table" class="table table-bordered">
    tr>
        td>编号td>
        td>贷款人td>
        td>账号td>
        td>身份证号td>
        td>日期td>
        td>贷款金额td>
        td>操作td>
    tr>
table>
a href="#" onclick="Show(‘first‘)">首页a>
a href="#" onclick="Show(‘prev‘)">上一页a>
a href="#" onclick="Show(‘next‘)">下一页a>
a href="#" onclick="Show(‘last‘)">尾页a>
input type="hidden" id="pageIndex" />
input type="hidden" id="totalPage" />
script>
    Show(‘first‘);
    function Show(page) {
        switch (page) {
            case ‘first‘:
                $(‘#pageIndex‘).val(1);
                break;
            case ‘prev‘:
                var num = Number($("#pageIndex").val());
                if (num > 1) {
                    $("#pageIndex").val(num - 1);
                }
                else {
                    $("#pageIndex").val(1);
                }
                break;
            case ‘next‘:
                var num = Number($("#pageIndex").val());
   
                if (num  Number($("#totalPage").val())) {
                    $("#pageIndex").val(num + 1);
                }
                else {
                    $("#pageIndex").val($("#totalPage").val());
                }
                break;
            case ‘last‘:
                $("#pageIndex").val($("#totalPage").val());
                break;
            default: break;
        }
        $.ajax({
            url: "http://localhost:54276/api/Default/Show?pageIndex=" + $("#pageIndex").val() + "&Name=" + $("#txt_Name").val(),
            type: "get",
            
            dataType: "json",
            success: function (d) {
                $("#totalPage").val(d.TotalCount);
                $("table tr:gt(0)").remove();
                
                $(d.List).each(function () {
                    var str = ‘
‘
                        + ‘ ‘;
                    $("#table tbody").append(str);
                })
            }
        })
    }
    function Del(Sid) {
        if (confirm("确认删除吗?")) {
            $.ajax({
                url: "http://localhost:54276/api/Default/Del?id=" + Sid,
                type: "delete",
                dataType: "json",
                success: function (d) {
                    if (d > 0) {
                        alert("删除成功");
                        location.href = ‘/Default/Show‘;
                    }
                    else {
                        alert("删除失败");
                    }
                }
            })
        }
    }
    function Upd(sid) {
        location.href = ‘/Default/Upd?Id=‘ + sid;
    }
    
script>
‘ + this.Id + ‘
 
‘
                        + ‘
‘ + this.Name + ‘
 
‘
                        + ‘
‘ + this.Zhon + ‘
 
‘
                        + ‘
‘ + this.identit + ‘
 
‘
                        + ‘
‘ + this.DDate + ‘
 
‘
                        + ‘
‘ + this.DMoney + ‘
 
‘
                        + ‘
 
‘
                        + ‘
@{
    ViewBag.Title = "Add";
}
Add
 
贷款人 
        
"Text1" type="text" /> 
    
 
账号 
        
"Text2" type="text" /> 
    
 
身份证号 
        
"Text3" type="text" /> 
    
 
日期 
        
"Text4" type="text" onclick="WdatePicker()" /> 
    
 
贷款金额 
        
"Text5" type="text" /> 
    
 
         
"Button1" type="button" value="添加"  onclick="Add()"/> 
    @{
    ViewBag.Title = "Login";
}
Login
 
用户名 
        
"txt_Name" type="text" /> 
    
 
密码 
        
"txt_Pwd" type="text" /> 
    
 
         
"Button1" type="button" value="登录" onclick="Login()" /> 
    @{
    ViewBag.Title = "Upd";
}
Upd
"hidden" id="txt_Id" value="@ViewBag.Sid"/>
 
贷款人 
        
"Text1" type="text" /> 
    
 
账号 
        
"Text2" type="text" /> 
    
 
身份证号 
        
"Text3" type="text" /> 
    
 
日期 
        
"Text4" type="text" onclick="WdatePicker()"/> 
    
 
贷款金额 
        
"Text5" type="text" /> 
    
 
         
"Button1" type="button" value="修改" onclick="Upd()" /> 
    
上一篇:Python初识函数