html页面json解析,通过HTML页面解析JSON数据

董胡非
2023-12-01

我得到JSON格式的字符串,我想将其发送到配置文件的.html 我的问题是如何保存的字符串,并与我从JSON获取变量解析它,给profile.html页面,因为我需要从页面到页面的会话和user_id变量。 当我调试时,debuger说'user_id'没有定义; 感谢的很多通过HTML页面解析JSON数据

enter code here

gloabl variables are User_id,Session;

var params ={

username: document.getElementById('usernameId').value,

password: document.getElementById('passwordId').value,

rememberMe :document.getElementById('rememberId').value,

};

login(params, function(data){

var account=JSON.stringify(data);

account=JSON.parse(account);

if(account.success==true){

User_id=account.user_id;

session=account.session;

window.location='profile.html';

}

enter code here

+1

可以请你告诉你的JSON字符串... –

+0

{ “user_ID的”: “123456”, “会话”: “ABCDEFG”} –

 类似资料: