多个ajax调用同一个 一般处理程序

来源:互联网 发布:sql group by详解 编辑:程序博客网 时间:2024/04/30 17:06
前台: $.post("GenericHandler/appointment_assess_Count.ashx", { action: "GetSchoolAddress" }, function (dataDZ) {}, "Json");$.post("GenericHandler/appointment_assess_Count.ashx", { action: "GetMajorType" }, function (data) {}, "Json");一般处理程序中:  public void ProcessRequest(HttpContext context)    {        context.Response.Clear();        context.Response.ContentType = "text/html";        string action = context.Request["action"].ToString();       if (action == "GetMajorType")        {            GetMajorType(context);        }         else if (action == "GetSchoolAddress")        {            GetSchoolAddress(context);        }    } public void GetMajorType(HttpContext context) {     context.Response.Write(Tool.ToJson(dblist)); } public void GetSchoolAddress(HttpContext context) {     context.Response.Write(Tool.ToJson(dblist)); }
原创粉丝点击