标签:js中文乱码 urldecoder encodeuri
关键词: js url中文乱码
前台代码:
function login() { $('#error_msg').hide(); var uname = $("#name").val(); var pwd = $("#password").val(); if(uname=="" || uname=="用户名") { $('#error_msg').text('用户名或密码不能为空!'); $('#error_msg').show(); return false; } if (pwd == "" || pwd == "密码") { $('#error_msg').text('用户名或密码不能为空!'); $('#error_msg').show(); return false; } $.getJSON("user/login", {loginName:encodeURI(uname),password:md5(pwd),passwordwy:pwd,ran: Math.random()}, function(result){ if(result.flag=="false") { $('#error_msg').text(result.returnMsg); $('#error_msg').show(); return; }else { Cookie.setcookie("userName",result.returnMsg); Cookie.setcookie("loginID",result.loginId); Cookie.setcookie("userId",result.id); window.location.href="index.html"; } }); }
String loginId = request.getParameter("loginName"); try { loginId = URLDecoder.decode(loginId,"UTF-8"); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); }
js 提交中午出现乱码的处理 encodeURI URLDecoder
标签:js中文乱码 urldecoder encodeuri
原文地址:http://blog.csdn.net/javaalpha/article/details/43764745