Enable link after update in Database

Asked

Viewed 14 times

0

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

inserir a descrição da imagem aqui

And on the site when the store is disabled in the manager, appear the message: Come back soon. I don’t get a lot of Jquery, could someone help me with this part? The status change is ready and developed in PHP and Mysql, would only enable and disable link automatically when changing status with Jquery. Remember that the page where you will change the link is in HTML.

1 answer

0

I managed to solve.

<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>

upgrade.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>";
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.