今日获取微信返回CODE 发现用EL取不到URL中?后面的参数
搜索后用下面方法解决:
$.extend({
getUrlVars: function(){
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;
},
getUrlVar: function(name){
return $.getUrlVars()[name];
}
});
var CODE = $.getUrlVar(‘code‘);
时间: 2024-10-25 15:54:24