**解决方法一:
url接受参数**
mui.openWindow({
url: "getIntegralShopOrder.html?order_id=" + order_id+'&client_name='+encodeURI(encodeURI(client_name)),
id: 'getIntegralShopOrder.html',
show: {
aniShow: 'slide-in-right'
duration: 300
}
})
//地址传参
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if(r != null) {
return unescape(r[2]);
} else {
return null;
}
}
//解析参数
var cline_name=decodeURIComponent(getUrlParam("client_name"));
alert(cline_name) //接收到的中文参数
解决方法二:
alert(encodeURI("我是中文"));
alert(decodeURI(encodeURI("我是中文")));
了解概念:
encodeURI() 函数可把字符串作为 URI 进行编码。 会被转化为”%25E6%B255%258B%25E8%AF%2595“
decodeURI() 函数可对 encodeURI() 函数编码过的 URI 进行解码
encodeURI 和 decodeURI 函数操作的是完整的 URI;这俩函数假定 URI 中的任何保留字符都有特殊意义,所有不会编码它们。
encodeURIComponent 和 decodeURIComponent 函数操作的是组成 URI 的个别组件;这俩函数假定任何保留字符都代表普通文本,所以必须编码它们,所以它们(保留字符)出现在一个完整 URI 的组件里面时不会被解释成保留字符了。
js对文字进行编码涉及3个函数:escape,encodeURI,encodeURIComponent,相应3个解码函数:unescape,decodeURI,decodeURIComponent