**
使用localStorage
a页面
var getInfo=setInterval(function () {
var accountLevel = $("#accountLevel").val();
var fansNum = $("#fansNum").val();
var focusarea = $("#focusarea").val();
var accountRole = $("#accountRole").val();
var dRIndex = $("#dRIndex").val();
var channel = $("#channel").val();
var aliWangWang = $("#aliWangWang").val();
var nickName = $("#nickName").val();
var platFrom = $("#paltFrom").val();
var homePageUrl = $("#homePageUrl").val();
var uniteBindText=$("#uniteBindText").val();
if(accountLevel){
if(uniteBindText){
uniteBindText=uniteBindText;
}else {
uniteBindText="";
}
var accountInfo={
"accountLevel":accountLevel,
"fansNum":fansNum,
"focusarea":focusarea,
"accountRole":accountRole,
"dRIndex":dRIndex,
"channel":channel,
"aliWangWang":aliWangWang,
"nickName":nickName,
"platFrom":platFrom,
"homePageUrl":homePageUrl,
"uniteBindText":uniteBindText
}
localStorage.setItem("accountInfo",JSON.stringify(accountInfo));
clearInterval(getInfo);
}
},1000);
设置key
b页面–获取值
var getInfo=setInterval(function () {
if(localStorage.getItem("accountInfo")){
var info=JSON.parse(localStorage.getItem("accountInfo"));
console.log(info);
//取到信息后删除
localStorage.removeItem("accountInfo");
var text="账号等级 : "+info.accountLevel+" 粉丝数 : "+info.fansNum+"\n"+
"专注领域 : "+info.focusarea+" 认证角色: "+info.accountRole+"\n"+
"达人指数 : "+info.dRIndex+" 拥有渠道: "+info.channel+"\n"+
"旺旺号 : "+info.aliWangWang+" 达人昵称: "+info.nickName+"\n"+
"30天浏览量: "+info.platFrom+" 达人主页链接:"+info.homePageUrl+"\n"+info.uniteBindText;
var content=$("#CONTENT").val();
if(content){
$("#CONTENT").val(content+"\n"+text);
}else {
$("#CONTENT").text(text);
}
clearInterval(getInfo);
}
},1000);
通过interval不断获取,获取到之后清除localStorage