1. The reference page JavaScript code:
function Go_mark (id,jobname,headimgurl,nickname) { window.location.href = "mark.html?id=" +id+ "&jobname=" + encodeURI (JobName) + "&headimgurl=" +headimgurl+ "&nickname=" +encodeuri (nickname); }
2. Receive the Parameters page:
$ (function () { var postdata = Getrequest (); $ (". Release_num em"). HTML (postdata.jobname); $ ("#img"). attr (' src ', postdata.headimgurl); $ (". Nick_name"). HTML (postdata.nickname); }) function Getrequest () { var url =decodeuri (decodeURI (Location.search));//Get URL "?" String, using two times Decoderui decoding var therequest = new Object (); if (Url.indexof ("?")! =-1) { var str = url.substr (1); STRs = Str.split ("&"); for (var i = 0; i < strs.length; i++) { therequest[strs[i].split ("=") [0]] = unescape (strs[i].split ("=") [1]);
} return therequest; } }
Note: The code here is used in conjunction with JQ, which is required to refer to the JQ file.
Original source: http://www.cnblogs.com/xiaodongaini/p/5031166.html
Solve the problem that JS parameter contains Chinese garbled characters when passing parameters in URL