Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass a variable between pages WinJS?

I'm trying to pass two variables from one page to the next. How would I go about doing this?

like image 523
dsta Avatar asked Jan 06 '13 05:01

dsta


2 Answers

Put this code in first page:

WinJS.Navigation.navigate("/pages/secondpage.html", yourvalue);

Then in second page to retrive the data use:

ready: function (element, options) {
    //your data yourvalue is inside options parametr 
}

Very good example about navigation

WinJS navigation example

WinJS navigation example 2

like image 130
Norbert Pisz Avatar answered Oct 02 '22 00:10

Norbert Pisz


Just wanted to include an example of passing multiple values as Norbert answered in his comment.

WinJS.Navigation.navigate("/pages/page2/page2.html", {value1:"hello",value2:"world"}
like image 21
Jeremy Foster Avatar answered Oct 02 '22 00:10

Jeremy Foster