ajax请求的问题。无法获取到传递过来的参数
$.ajax({ type: "POST", url: "ValueChange.ashx", data: { sm: logInfo }, contentType: "application/text; charset=utf-8", success: function() { var session = '<%=Session["aa"]%>'; alert(session); return true; } });
using System;using System.Collections;using System.Data;using System.Linq;using System.Web;using System.Web.Services;using System.Web.Services.Protocols;using System.Xml.Linq;using System.Web.SessionState;namespace ValueChangePro{ /// <summary> /// $codebehindclassname$ 的摘要说明 /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class Handler1 : IHttpHandler, IRequiresSessionState { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; var log = context.Request.QueryString["sm"]; context.Session["aa"] = log; } public bool IsReusable { get { return false; } } }}