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>
  • 相关阅读:
    Java中导入、导出Excel
    ExtJS框架基础:事件模型及其常用功能
    sql索引的优缺点
    Sword框架解析——知识采集流程页面初始化
    ObjectMapper处理从远程获取的Object对象 (http://bbs.csdn.net/topics/390337813?page=1)这个网址也有讲解
    SQL语言基本操作(聚合函数)
    Java并发性和多线程介绍目录
    Hibernate中load与get,update与merge方法的区别
    JDK各个版本的新特性jdk1.5-jdk8
    [LintCode] Longest Increasing Continuous subsequence
  • 原文地址:https://www.cnblogs.com/GuoLianSheng/p/13223543.html
Copyright © 2011-2022 走看看