If the parameters passed are:
The js for getting the url parameters is as follows:
/**Initial loading completed*/
function getUrlVars(){
var vars = [], hash;
var hashes = window.location. href.slice(window.location.href.indexOf('?') 1).split('&');
for(var i = 0; i < hashes.length; i ) {
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
If there is Chinese in the url, there will be Chinese garbled characters when taking the parameters. You have to use the decodeURI() method to decode, as follows:
//Get the pkId of the category
var params = getUrlVars();
//Get the id of this category
var parentId = params[params[0]];
//Get the name of the category
var productName = decodeURI(params[params[1]]);
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn