• c#中$.ajax的使用


     
    <script type="text/javascript">
     var telphone = { type: "getphone", "num": dianhua, "typestr": index };
                    $.ajax({
                        type: 'POST',
                        url: '/webService/GetMobile.ashx',
                        data: telphone,
                        dataType: 'text',
                        success: (function (data) {
                            if (data == "ok") {
                                alert("提交成功!");
                                $(".storesContents_Box1:eq(" + index + ") .txtmobile").val("");
                                $(".storesContents_Box1:eq(" + index + ") .txtmobile").focus();
                            }
                            else {
                                alert("提交失败!");
                            }
                        })
    </script>
    后台 GetMobile.ashx'
     public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
     
            var type = context.Request.Params["type"];
            var telphoneNumber = context.Request.Params["num"];
            if (!string.IsNullOrEmpty(telphoneNumber))
            {  
                using(EF db = new EF())
                {
                    Telphone xTelphone = new Telphone();
                    xTelphone.Telphone = telphoneNumber;
                    db.Telphone.AddObject(xTelphone);
                    db.SaveChanges();
                }
            }
            switch (type)
            {
                case "getphone":
                    {
                        context.Response.Write("ok");
                        break;
                    }
            }
        }
     
        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    
     
    
    
  • 相关阅读:
    [转]Nvidia 的Shadow 文章收集
    [转]Linear Depth Buffer(线性深度缓冲区)
    [转]ParallelSplit Shadow Maps on Programmable GPUs
    [转]Learning to Love your Zbuffer.
    SQL SERVER存储过程中使用事务
    VS2005+SQL2005 Reporting Service动态绑定报表(Web)
    Sql批量删除/插入
    存储过程中执行动态Sql语句
    存储过程中使用事务
    真正的全动态报表:RDLC+ReportViewer
  • 原文地址:https://www.cnblogs.com/ft-Pavilion/p/4481902.html
Copyright © 2020-2023  润新知