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();
        }

  • 相关阅读:
    “人工智能”前景:只有人工,没有智能
    google scholar vs baidu scholar-what is your problem
    springSecurity使用
    springMVC中的HttpSession与Model
    mybatis关于Criteria的一点小坑。。。
    MyBatis的Mapper接口以及Example的实例函数及详解
    被springSecurity坑哭的一天
    Mybatis-Generator
    Redis五种数据类型应用场景
    springboot_自动配置原理
  • 原文地址:https://www.cnblogs.com/keanuyaoo/p/3292279.html
Copyright © 2011-2022 走看看