Search code examples
javascripthtmlwindows-8winjs

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?


Solution

  • 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