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. 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 ?
2 に答える
0
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);
}
于 2013-06-24T11:41:14.157 に答える
0
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>
于 2013-06-24T07:58:38.673 に答える