I'm trying to pass two variables from one page to the next. How would I go about doing this?
How to pass a variable between pages WinJS?
Asked Answered
Do you really mean variables or parameters? –
Inveigh
Well, values in variables. I need to pass a string and an integer. –
Callipash
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
}
Can I only pass one value? –
Callipash
By navigation function only one value. But you can pass a object or array. Se the firs link for more information. –
Virulent
Thank you so much! I finally get it! lol...I was able to pass the variables successfully! –
Callipash
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"}
© 2022 - 2024 — McMap. All rights reserved.