[英]Passing value from one html to another page
I have basic web application developed in node.js,mongodb and jquery/javascript. 我有在node.js,mongodb和jquery / javascript中开发的基本Web应用程序。 I have login page (login.html [public folder]) with username and password inputs.
我有登录页面(login.html [公共文件夹]),其中包含用户名和密码输入。 On login action REST API gets data from mongodb and sends as JSON object back to login.html.
登录操作时,REST API从mongodb获取数据,并将其作为JSON对象发送回login.html。 On success i will redirect to dashboard.html with
window.location("/")
. 成功后,我将使用
window.location("/")
重定向到dashboard.html。 Now i have a <a>
in dashboard where i want to set the name from the JSON object. 现在我在仪表板中有一个
<a>
,我想在其中设置JSON对象的名称。
I saw one solution with localstorage
, is there any other way to do this without using any framework like knockout,backbone or angualr. 我看到了一个使用
localstorage
解决方案,是否有其他方法可以执行此操作而无需使用诸如剔除,主干或angualr之类的框架。 I am looking for modeling the JSON object at sucess call back from REST API and share the model at other pages. 我正在从REST API的成功回调中寻找JSON对象的模型,并在其他页面上共享模型。
如果您不想使用后端或本地存储,则唯一的选择是cookie。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.