locked
WinJs.Navigation.navigate is not working in windows 8

    Question

  • When I am trying to navigate the page that is not working

      function Login() {
            var username = document.getElementById('txtUsername').value;
            var password = document.getElementById('txtPassword').value;
            var register_model = { UserName: username, Password: password };
            var Json = JSON.stringify(register_model);
            $.ajax({
                type: "POST",
                cache: false,
                contentType: "application/json; charset=utf-8",
                url: 'http://localhost:25358/api/Login',
                data: Json,
                success: function (result, status) {
                    document.getElementById('txtResult').innerHTML = result;
                    if (result == "Success") {
                        DisplayMessageBox();
                        WinJS.Navigation.navigate("ms-appx:///Homepage.html");               
                    }
                },
                error: function (xhr, ajaxOptions, thrownError) {
                    alert(xhr.status);
                    alert(thrownError);
                }
            });
        }
    

    When i am trying to navigate the page but it is not working 


    Sivalingam

    Monday, October 15, 2012 4:00 PM

Answers

  • Hi,

    Try to use WinJS.Navigation.navigate("Homepage.html");              

    Any more question, please feel free to reply.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com
    Microsoft One Code Framework

    • Marked as answer by Song Tian Monday, October 22, 2012 1:42 AM
    Tuesday, October 16, 2012 9:34 AM

All replies

  • You'll need to post more details on what exactly is not working.  

    Is the WinJS.Navigation.navigate function not being called?  Or is it navigating but no code is executing on the next page?  Or is WinJS.Navigation.navigate getting called but nothing is happening?  Are there any JavaScript errors in the console? 


    -Jeff

    Monday, October 15, 2012 6:18 PM
  • Hi jfrtc,

    Thanks for your reply

    The Problem was the function(WinJS.Navigation.navigate) is getting called but not navigating to the certain page.


    Sivalingam

    Tuesday, October 16, 2012 4:14 AM
  • Hi,

    Try to use WinJS.Navigation.navigate("Homepage.html");              

    Any more question, please feel free to reply.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com
    Microsoft One Code Framework

    • Marked as answer by Song Tian Monday, October 22, 2012 1:42 AM
    Tuesday, October 16, 2012 9:34 AM
  • Calling navigate is one half of the navigation contract, somewhere in your app you'll need to also sign up for an event from the navigation namespace, for an example of this you can see the PageControlNavigator in the VS Grid templates for WinJS.
    Saturday, October 20, 2012 7:34 PM