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>
  • 相关阅读:
    windows下python3.6环境搭建
    接口自动化(2)----如何编写接口自动化用例
    关于接口自动化测试的规则说明
    linux 常用命令 补充
    linux 常用命令
    linux 初识
    java高级教程 JDK代理和CGLIB代理两种方式 账户类
    java高级教程 实例化和非实例化 bean 学生信息
    java高级教程 俩数之和
    C++使用printf输出string类
  • 原文地址:https://www.cnblogs.com/GuoLianSheng/p/13223543.html
Copyright © 2011-2022 走看看