Enable link after update in Database

0

I need to have the admin of the virtual store after enabling the store by the manager, the link in the site is enabled automatically. See:

And on the site when the store is disabled in the manager, the message: Come back soon. Not much of Jquery, could anyone help me in this part? The status change is ready and it was developed in PHP and Mysql, it would just be the enable and disable link automatically in the status change with Jquery. It is worth remembering that the page where you will change the link is in HTML.

    
asked by anonymous 02.11.2017 / 15:00

1 answer

0

I was able to resolve it.

<div id="link"></div>

      <script type="text/javascript">
            $(document).ready(function(){
                atualizar();
           });
           var atualizar = function(){
              $.get('atualizar.php',function(resultado){
                     $('#link').html(resultado);
              });
           setTimeout('atualizar()', 3000);
    }
    </script>

update.php

$sql = mysqli_query($conexao,"SELECT * FROM loja_habilitada;");
$jm = mysqli_fetch_object($sql);

if($jm->Habilitada == '1'){
  echo "<a href= \"https://loja.sitedocliente.com.br\" class=\"mix-link\" target=\"_blank\">Acessar</a>";
}else{
  echo "<a href= \"#\" class=\"mix-link\"  data-toggle=\"modal\" data-target=\"#myModal1\">Acessar</a>";
}
    
02.11.2017 / 15:13