zoukankan      html  css  js  c++  java
  • jquery 使用ajax调用c#后台方法

         $.ajax({
                            type: "get",
                            cache: false,
                            //方法所在页面和方法名     
                            url: "ShareCus.aspx",
                            data: { "name": para,"xml":"1" },
                            contentType: "application/json; charset=utf-8",
                            dataType: "text",
                            success: function (data) {
                                $('#<%=lb_dutyname.ClientID%>').text(data);
                            },
                            error: function (err) {
                                alert(err);
                            }
                        });

    .cs

     protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request["xml"]==null)
                {
                }
                else
                {
                    GetTip(Request["name"]??string.Empty);
               
                }

            }

        }

     public   void GetTip(string name)
        {
            string result = string.Empty;
            Users user = null;
            if (!string.IsNullOrEmpty(name))
            {

     result=name+"1111";
             }
            Response.Clear();
            Response.Write(result);
            Response.End();
        }

  • 相关阅读:
    SQL 学习笔记(一)联表查询
    .NET (OleDb) Access 各个版本的连接字符口串
    加油站
    程序员的编程套路
    落单的数
    读《怎样解题》
    使用org-mode写cnblogs博客
    Emacs 25.1 error solved: url-http-create-request: Multibyte text in HTTP request
    二进制表示小数
    快速幂
  • 原文地址:https://www.cnblogs.com/keanuyaoo/p/3292279.html
Copyright © 2011-2022 走看看