4 Replies Latest reply on May 7, 2013 11:36 PM by Ankur Srivastava

    Passing value from login erb to next welcome controller

      I have to pass username from login screen to to welcome control.

       

      In the applications/index.erb i have created the form with submit action with js and loading welcomeController with page slide;

      <script>

             $(function(){

               $("form[name=login-form]").submit(function(event){

                   event.preventDefault();

                   if($("input[name=Username]").last().val()!=="" && $("input[name=Password]").last().val()!==""){

                     var text = $("#username").val();

                     $.mobile.changePage("WelcomeController",{transition:"slide"});

                   } else {

                     alert("Please fill all the required details!");

                     return false;

                   }          

               });

             });

           </script>

       

       

       

      In the WelcomeController/index.erb

      <span >Welcome <%= @userName %>!</span>

       

      WelcomeController.rb

      @userName =  'Guest'

      static now, i want to make the username dynamic with the entered username in login screen.

       

      Please help me out.