ajax传参:  $.post("MAIN_JSHandler.ashx",
                               { "retInfoCode": retobj.retInfo.Code,
                                   "retInfoMsg": retobj.retInfo.Msg,
                                   "FPInfo": escape(str),
                                   "ExtraFPInfo": retobj.Extra.FPInfo
                               },
                               function(data) {
                                   alert(1);
                               },
                               "json"
                        );

传递中文信息除了要用escape,在后台还需要用

context.Response.ContentType = "text/plain";
            string retInfoCode = context.Request.Params["retInfoCode"];
            string retInfoMsg = context.Request.Params["retInfoMsg"];
            string FPInfo = System.Web.HttpUtility.UrlDecode(context.Request.Params["FPInfo"]);
            string message = "";
            string ExtraFPInfo = context.Request.Params["ExtraFPInfo"];

也就是System.Web.HttpUtility.UrlDecode解码,

这样就能正常使用。

05-06 18:41