Add if else function in Ajax Jquery function
- by Naga Botak
Is it possible to add other else function in my JS like this: ?
if response == success redirect to home
if response == failed redirect to failed
$.ajax({
type: "POST",
url: action,
data: form_data,
success: function(response)
{
if(response == 'success')
window.location.replace("home");
else
$("#message").html("<div class='error_log'><p class='error'>Invalid username and/or password.</p></div>");
}
});