title: Ajax and HTML lossing html modification
body: <p>My problem is the following one.</p>
  
  <p>This is the method that allow me to change my index html depending if I am logged as an user or not, the problem is when I am connected in the web page during X miliseconds my index.html shows what's expected ( this method changes my index.html differentiating between the window from logged user and Anonymous ones) it shows an iframe which only  connected users can see.
  But it suddenly returns to the initial state of my web page.</p>
  
  <p>Some idea?</p>
  
  <p><strong><em>index.html</em></strong></p>
  
  <pre><code>$(document).ready(function(){  
      $('#sendLogin').click(function() {  
  
          $.ajax({ 
          type: "POST", 
          url: "login.php",  
          data: $(formLogin).serialize(),
             success:function(data) 
              {
               if (data.toString().trim() == "Si") {
                 $("#elementos").css('display' , 'inline');
               }
               else {
                alert ("No he entrado");
               }
              }
          });  
      });  
  });
  </code></pre>
  
  <p><strong><em>login.php</em></strong></p>
  
  <pre><code>    &lt;?php
  
  include "conectarse.php";
  
  //Obtener los datos de la pag web.
  $usuario = $_POST['botonUser'];
  $pass1 = $_POST['botonPass'];
  
  //Procedo a conectarme a la Base de Datos
  $link = conectarse($baseDatos);
  
  $query_select = "SELECT * FROM usuarios WHERE usuario = '$usuario' AND pass = '$pass1';";
  
  $registro = $link-&gt;query($query_select);
  
  if($row = mysqli_fetch_array($registro))
      {    
      session_start();
  
      $_SESSION['nom'] = $row['nombre'];
      $_SESSION['apellido'] = $row['apellido'];
      $_SESSION['usuario'] = $row['usuario'];
      $_SESSION['tiempo'] = strftime("Hoy es %A y son las %H:%M");
  
      echo 'Si';
  
      }
      else {
          session_start();
  
          echo "No";
          $_SESSION['nom'] = "Anonimo";
      }
  
  $link-&gt;close();
  
  ?&gt;
  </code></pre>