简体   繁体   English

我如何仅使用客户端将数据从一个视图传递到另一个视图?

[英]how can i pass the data from one view to another using client side only?

My scenario is that i am building a framework like web application where user can build his own page and he/she can preview it. 我的情况是,我正在构建一个像Web应用程序这样的框架,用户可以在其中构建自己的页面,并且他/她可以对其进行预览。 Giving the preview functionality on the same page is pretty easy but i want to give it on a new pop up window which will open on a button click. 在同一页面上提供预览功能非常容易,但我想在一个新的弹出窗口中提供它,单击该按钮即可打开。 Here i want to pass a JavaScript variable from one view to another(may be an HTML page),and i don't want to use server for this task because the data is pretty temporary so at the client side how can i pass the variable using JavaScript or j-Query ? 在这里,我想将JavaScript变量从一个视图传递到另一个视图(可能是HTML页面),并且我不想使用服务器来执行此任务,因为数据是非常临时的,因此在客户端如何传递变量使用JavaScript还是j-Query?

in using a jquery plugin have a js for cookie.the following example can useful for u.
first set value into cookie the following way
 <script src="js/jquery.cookie.js"></script>
   $.cookie("Token",value);
in another page u get this cookie using cookie name. 
   var Cookie=$.cookie("Token");
when  u need to pass a value use this source on that page with jquery plugin.
<script src="js/jquery.cookie.js"></script>
if pass the one page to another page means simple to use cookies.otherwise using only on inside single page  use the following code.
var a;
var b;
var x=10;
var y=mark;
<button onclick="myfunction(\''+x+'\',\''+y+'\');">click</button>
function myfunction(x,y)
{
a=x;
b=y;
console.log(a,b);
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用RenderAction将数据从一个视图传递到另一个视图 - How to pass data from one view to another using RenderAction 如何仅使用JavaScript将表单数据从一个HTML页面传递到另一HTML页面? - How do I pass form data from one HTML page to another HTML page using ONLY javascript? 如何使用 JavaScript 将数据从一个 HTML 页面传递到另一个页面 - How can i pass data from one HTML page to another using JavaScript 如何使用PHP和Javascript将数据从一页传递到另一页? - How can I pass data from one page to another using PHP and Javascript? 如何使用JavaScript将列表组之类的数据从一个HTML页面传递到另一HTML页面? - How can I pass data like list group from one html page to another using JavaScript? 如何使用 signalr 从集线器传递数据以查看 - How can I pass Data from Hub to view using signalr 如何将单击/选定的行数据从一个表传递到另一个并排放置的表 - How to pass clicked/selected row data from one table to another table that are placed side by side 如何在Rails中使用Ajax将文本从一个路由(/ client / 1)发送到另一路由(/ client / 2)? - How can I send text to from one route (/client/1) to another route (/client/2) using ajax in rails? 如何仅使用JavaScript将数据从一页传递到另一页? - how to pass data from one page to another page using only javascript? 如何在没有PHP的情况下用PHP和Javascript将数据从一页传递到另一页? - How can I pass data from one page to another in PHP and Javascript without from?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM