$(".alert-dismissible").fadeOut(0); 

$('#login_form').submit(function(e)
{ 
  if($('#login_form').parsley().isValid()) 
  {    
    e.preventDefault();
    $.ajax({      
        url : CONTROLLER + '/check_auth',            
        type:"POST",
        data:new FormData(this), 
        processData:false,
        contentType:false,
        cache:false,
        async:false,
        dataType: "JSON", 
        success: function(returnData)
        { 
            if(returnData.status  == 'Success')
            {  
              $(".alert-success").show(); 
              $(".alert-success-msg").html(returnData.message);
              setTimeout(function () 
              { 
                $(".alert-danger").fadeOut(500); 
                window.location.href = BASEURL + 'categories';  
              }, 2500);              
            } 
            else
            { 
              $('#login_form')[0].reset();
              $(".alert-danger").show(); 
              $(".alert-danger-msg").html(returnData.message);
              setTimeout(function () 
              { 
                $(".alert-danger").fadeOut(500); 
              }, 2500);
            } 
        }
    });
    return false;
  }  
});