title: Display a session var without refresh the page
body: <p>I set a session var in an ajax file like that :<code>$_SESSION['id_essai']=$ligne[1];</code>. The value of this var should change at each submit of the form. </p>
  
  <p>Without recharge the page, I want to get the value of this var. So I echo it like that : <code>echo $_SESSION['id_essai'];</code> 
  My problem is, when I try to echo it, I get the previous value until I recharge the page. I want to refresh this var without recharge the page. How can I do that ? </p>
  
  <p><strong>EDIT :</strong></p>
  
  <p>I send a handsontable grid to my ajax file like that :</p>
  
  <pre><code>$(document).ready(function(){
          $('#submit_button_essai').click(function(){
  
              $.post("ajax_insert_essai.php",{arr:data_essai}, insert_essai_callback,'json'); 
              return session;
          });
      });
  </code></pre>
  
  <p>In this ajax file, I declare my session var with one value of this grid and I can return it like that :</p>
  
  <pre><code>array_unshift($tab_erreur,$_SESSION['id_essai']);
  
      echo json_encode($tab_erreur);    
  </code></pre>
  
  <p>So I send an array of errors AND the session var that I process like that in my callback function:</p>
  
  <pre><code>function insert_essai_callback(responseObject,ioArgs) //ajax renvoie les indices des cases erronnées et les messages correspondants.
  {
  var jsonobject = eval(responseObject);
  console.log(jsonobject);
  //alert(jsonobject[0]);
  var session = jsonobject[0];
  
  for(var item in jsonobject)
  {       
          if((item % 2 ) == 0) //Si l'indice est pair, on affiche la couleur
          {
              $("td").eq(jsonobject[item-1]).after("&lt;div class=\"message\"&gt;"+jsonobject[item]+"&lt;/div&gt;");
          }else //Si l'indice est impair, on affiche le message 
          {
              $("td").eq(jsonobject[item]).css("background-color","red");
          }   
  
  }
  
  }
  </code></pre>
  
  <p>My session var is in <code>jsonobject[0]</code>. 
  That's my code after trying to return the session var in ajax.</p>