I use the following code in my MVC application to log in to the user system. If I return "1", I redirect the user to the control panel view, otherwise the login was unsuccessful.
$.post($("form").attr("action"), $("form").serialize(), function (data) { if (data == "1") window.location.href = '/dashboard'; else $("#result").html('bad username or password'); });
Is there a better way to do this using the MVC environment so that when a form is submitted, the user can be redirected or not based on login success / failure?
Thanks for all the answers.
klork source share