怎么解决HTML界面间传递中文参数的乱码问题呢?
1.可以使用encodeURI编码,decodeURI解码
//点击搜索
var searchUrl =encodeURI("search.html?searchText="+searchText); //使用encodeURI编码
window.location.href =searchUrl;
//获取 上一个搜索页面传来的参数
var searchUrl =window.location.href;
var searchData =searchUrl.split("="); //截取 url中的“=”,获得“=”后面的参数
var searchText =decodeURI(searchData[1]); //decodeURI解码
$(".keyword1").val(searchText); //将搜索的数据显示在搜索页面的搜索框中
参考 :https://blog.csdn.net/qq_30979185/article/details/72794359