码迷,mamicode.com
首页 > Web开发 > 详细

js URL中文传参乱码

时间:2016-12-28 12:48:36      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:component   传参   href   乱码   name   span   arch   color   arc   

 

js:

   var searchVal = encodeURIComponent($.trim($(‘#js_search_val‘).val()));//搜索的值 encodeURIComponent() 函数可把字符串作为 URI 组件进行编码。

window.location.href = gUrl + ‘/name/‘ + searchVal;//跳转


php:
urldecode(); 将 URL 编码后字符串还原成未编码的样子 









js URL中文传参乱码

标签:component   传参   href   乱码   name   span   arch   color   arc   

原文地址:http://www.cnblogs.com/hellozg/p/6228689.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!