         function myFunction() {
         var x = document.getElementById("pass");
         if (x.type === "password") {
         x.type = "text";
         } else {
         x.type = "password";
         }
         }
   
       
         $(document).ready(function(){ 
                $("#login").click(function()
                { 
                  var user = document.getElementById("email").value;
                  var pass = document.getElementById("pass").value;
                  document.getElementById("loginmsg").innerHTML="";
                       $.ajax({
                    url:"login1.php",
                    method:"POST",
                    data:{user,pass},
                    success:function(data)
                    {
                      if(data=='invalid')
                      {
                      $('#loginmsg').html('Invalid login credentials!').css('color', 'red'); 
                
                       setInterval(function() 
                        {
                          $('#loginmsg').html('').css('color', 'red');   
                        }, 4000);
    
                      }else if(data=='acessno')
                      {
                       $('#loginmsg').html('Sorry. You have no right to access the system for now!').css('color', 'red');
                      }else if(data=='granted')
                      {
                        $('#loginmsg').html('ACCESS GRANTED').css('font-weight','bold','width','100%'); 
                        $('#responseholder').val('GRANTED');
                        
                        let intervalId = setInterval(function() 
                        {
                        var res = document.getElementById("responseholder").value; 
                        if(res=='GRANTED')
                        {
                        window.location.href='data/index.php?page=dashboard';
                        }
                        clearInterval(intervalId); 
                        }, 1000);
                        
                      }else{
                         $('#loginmsg').html(data).css('color', 'red');
                      }
                    }
                  });
             
                  });
                });
             
     