zoukankan      html  css  js  c++  java
  • ajax 简单案例

    前台

    <script type="text/javascript"> 
    function userdel(id) {
    alert("dd");
        if (confirm('确定删除编号为' + id + '管理员吗')) {
            $.ajax({
                type: "get",
                url: "WebForm1.aspx",
                cache: false,
                async: false,
                datatype: "json",
                data: { "flag": "删除管理员", "id": id },
                success: function (data) {
                alert(data);
                    // 字符串拼接
                    $("#div_user").html(data);
                }
            })
        }
        }

    </script>

    <body>
        <form id="form1" runat="server">
        <div id="div_user">
            <input type="button" value="不满意,重新拍" name="Submit0" id="Button1" onclick="userdel(4)" />
        </div>
        </form>

    后台

    protected void Page_Load(object sender, EventArgs e)
            {
                string ret_context = "";
                string flag =Request["flag"];
               
                string id = Request["id"];
                switch (flag)
                {
                    case "删除管理员": ret_context = "成功"; break;
                    default: ret_context = "系统错误"; break;
                }
                Response.ContentType = "text/plain";
                Response.Write(ret_context);
            }

  • 相关阅读:
    hdu 5392 Infoplane in Tina Town(数学)
    hdu 5391 Zball in Tina Town(打表找规律)
    poj 2251 Dungeon Master(bfs)
    hdu 5313 Bipartite Graph(dfs染色 或者 并查集)
    [转]notifyDataSetChanged() 动态更新ListView
    Android之Intent
    LinearLayout 和 RelativeLayout
    poj 2955 Brackets(区间dp)
    poj 1651 Multiplication Puzzle(区间dp)
    poj 3186 Treats for the Cows(区间dp)
  • 原文地址:https://www.cnblogs.com/110abcd/p/5550146.html
Copyright © 2011-2022 走看看