Click here to Skip to main content
16,020,840 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having a login page when user log in i have to show Successful login.I am using MVC and jquery but my alert message was popping up before validation.I want to show the message after the username and pwd are validated.

JavaScript
<script>

    $('#btsubmit').click(function () {

       
        alert("Logged in");
    });
</script>


<input type="submit" id="btsubmit" value="Log in" />

C#
[ValidateAntiForgeryToken]
       public ActionResult Login(LoginModel model, string returnUrl)
       {
           if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe))
           {

               return RedirectToLocal(returnUrl);
           }

           // If we got this far, something failed, redisplay form
           ModelState.AddModelError("", "The user name or password provided is incorrect.");
           return View(model);
       }
Posted
Updated 26-Apr-15 23:33pm
v2

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900