首页 > 代码库 > jquery的ajax()函数传值中文乱码解决方法介绍

jquery的ajax()函数传值中文乱码解决方法介绍

 

前台

 jQuery.post("/MailTemplate/SaveMailTemplate?Code=" + item.Code + "&DisplayName=" +encodeURI   (item.DisplayName) + "&Body=" +encodeURI(item.Body), {}, function (data) {
               
                if (data =http://www.mamicode.com/= ‘Success‘) {
                } else {
                    ShowMessBox(data.Mess);
                }
            });

后台

 [HandleError]
        [HttpPost]
        public JsonResult SaveMailTemplate(MailTemplate m)
        {
            mailTemplate.UpdateMailTemplate(m.Code, HttpUtility.UrlDecode(m.Body), HttpUtility.UrlDecode(m.DisplayName));
            return Json("Success");
        }