zoukankan      html  css  js  c++  java
  • Mv添加显示

    <script>
        $(function () {
            show();
        });
        function show() {
            $.ajax({
                url: "http://localhost:61678/api/search",
                data: null,
                dataType: "json",
                type: "get",
                success: function (result) {
                    ShowList(result);
                }
            })
        }
        function ShowList(result) {
            var str = "";
            $.each(result,function (i, n) {
               
                str += "<tr><td>" + n.ID + "</td>";
                str += "<td>" + n.ActivityName + "</td>";
                str += "<td>" + n.Name + "</td>";
                str += "<td>" + n.Common + "</td>";
                str += "<td>" + n.Num + "</td>";
                str += "<td>" + n.Balance + "</td>";
                str += "<td>" + n.Number + "</td>";
                str += "<td>" + n.BalanceNum + "</td>";
                str += "<td>" + n.State + "</td>";
                str += "<td>" + n.Type + "</td>";
                str += "<td>" + n.Remark + "</td>";
                str += "<td>" + n.CreateTime + "</td></tr>";
               
            });
            $("#tb tr:gt(0)").empty();
            $("#tb").append(str);
        }
    </script>
    ////////*****///////
    <script>
        $(function () {
            Type();
            State();
            $("#Save").click(function () {
                var obj = {};
                obj.Name = $("#Name").val();
                obj.Type = $("#TName option:selected").val();
                obj.Num = $("#Num").val();
                obj.Balance = $("#Balance").val();
                obj.Number = $("#Number").val();
                obj.BalanceNum = $("#BalanceNum").val();
                obj.Common = $("#Common").val();
                obj.State = $("#SName option:selected").val();
                $.ajax({
                    url: "http://localhost:61678/api/Append", //要处理的页面
                    data: obj,  //要传过去的数据
                    type: "POST",  //提交方式
                    dataType: "TEXT", //返回的数据类型,TEXT字符串 JSON返回JSON XML返回XML;dataType中T要大写!!
                    success: function (res) { //回调函数,data为形参,是从login-cl.php页面返回的值
                        if (res > 0) {
                            alert("添加成功");
                            location.href = "http://localhost:63528/Red/Show";
                        }
                        else {
                            alert("添加失败");
                        }
                    }
                });
            });
        });
        //反填下拉框
        function Type() {
            $.ajax({
                url: "http://localhost:61678/api/type",
                dataType: "json",
                type: "get",
                success: function (result) {
                    $(result).each(function (i, n) {
                        $("#TName").append("<option value='" + n.TID + "'>" + n.TName + "</option>");
                    })
                }
            })
        };
        function State() {
            $.ajax({
                url: "http://localhost:61678/api/state",
                dataType: "json",
                type: "get",
                success: function (result) {
                  
                    $(result).each(function (i, n) {
                        $("#SName").append("<option value='" + n.SID + "'>" + n.SName + "</option>");
                    })
                }

            })
        };
    </script>
  • 相关阅读:
    剑指offer[30]——连续子数组的最大和
    移动端数据爬取
    Scrapy框架基础应用和持久化存储
    爬虫的验证码处理,图片懒加载,selenium和 PhantomJS,requests模块的session,线程池
    爬虫之数据解析(bs4,Xpath)
    爬虫之jupyter的使用,requests模块,正则表达式
    git的分支,多人协作,标签管理
    git 的基础
    利用python操作excel表
    nginx基于uwsgi部署Django
  • 原文地址:https://www.cnblogs.com/GuoLianSheng/p/13223543.html
Copyright © 2011-2022 走看看