location.href方式跳转传值中文乱码解决
2017-06-17 16:51
274 查看
1、前端用encodeURI(encodeURI(plateName))两次转义;
var plateId = $(".plateContent").attr("plateId");//设置plateId
var plateName = $(".plateContent").html();//设置plateName
var dinersName = $("#dinersName").val();
var dinnerMobile = $("#dinnerMobile").val();
var userName = $("#userName").val();
var userMobile = $("#userMobile").val();
location.href="${ctx}/table/calendar.do?plateId="+plateId+""&plateName="+encodeURI(encodeURI(plateName))+
"&dinersName="+encodeURI(encodeURI(dinersName))+
"&dinnerMobile="+dinnerMobile+
"&userName="+encodeURI(encodeURI(userName))+
"&userMobile="+userMobile+
"&advBookDays="+advBookDays;
2、Java后台用URLDecoder.decode(name, "UTF-8")解码
String userName = URLDecoder.decode(wmTableorder.getUserName(), "UTF-8");
借鉴地址
var plateId = $(".plateContent").attr("plateId");//设置plateId
var plateName = $(".plateContent").html();//设置plateName
var dinersName = $("#dinersName").val();
var dinnerMobile = $("#dinnerMobile").val();
var userName = $("#userName").val();
var userMobile = $("#userMobile").val();
location.href="${ctx}/table/calendar.do?plateId="+plateId+""&plateName="+encodeURI(encodeURI(plateName))+
"&dinersName="+encodeURI(encodeURI(dinersName))+
"&dinnerMobile="+dinnerMobile+
"&userName="+encodeURI(encodeURI(userName))+
"&userMobile="+userMobile+
"&advBookDays="+advBookDays;
2、Java后台用URLDecoder.decode(name, "UTF-8")解码
String userName = URLDecoder.decode(wmTableorder.getUserName(), "UTF-8");
借鉴地址
相关文章推荐
- location.href方式跳转传值中文乱码解决
- window.location.href=传值的中文乱码解决方法
- 利用jquery实现Ajax技术,post方式传值中文乱码问题的解决办法。
- 解决document.location.href下载文件时中文乱码
- window.open()、location.href下载文件时中文路径乱码解决
- 中文乱码问题--window.location.href url含中文服务器收到乱码问题解决
- URL中文传值乱码解决方式
- 中文乱码问题--window.location.href url含中文服务器收到乱码问题解决
- 关于Struts2使用redirectAction方式在两个Action之间传值时中文乱码问题的解决方法
- location.href传中文参数与java编解码解决get请求乱码
- window.location.href url含中文服务器收到乱码问题解决
- IE和chrome中,windows.location.href的不同跳转路径的解决方式
- JQuery中Ajax的Post提交中文乱码、windows.location.href 中文汉字乱码和springmvc使用原生态HttpServletRequest接收参数中文乱码解决办法
- 用document.location.href下载文件时中文路径乱码解决
- 中文乱码问题与解决方式
- post跟get方式中文乱码以及解决方法
- java 页面url传值中文乱码的解决方法。
- request、response 中文乱码问题与解决方式
- js中页面跳转(href)中文参数传输方式
- javaweb使用 window.location.href 传中文参数 乱码问题