I am using the following code in my MVC application to login a user. If I get back "1", I redirect user to the dashboard view else login is 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 via the MVC framework such that upon submission of the form, user can be redirected or not based upon login success/failure?
Thanks is advance for all replies.