title: jQuery AJAX - Set PHP Session variable
body: <p>I am looking to store a variable across an entire session so that when a user closes a promotional bar it stays closed and doesn't pop back up every time they navigate to a new page.</p>
  
  <p>On page load I have the following:</p>
  
  <pre><code>$.ajax
  ({ 
    url: 'promo.php',
    type: 'post',
    data : formData,
    success: function(result)
    {
      alert(result);
    }
  
  });
  </code></pre>
  
  <p>The formData isn't too important right now as it isn't used.*</p>
  
  <p><strong>promo.php:</strong></p>
  
  <pre><code>&lt;?php
  
    if (isset($_SESSION['promoBar'])) {
  
      echo $_SESSION['promoBar'];
  
    }
    else {
  
      $_SESSION['promoBar'] = "closed";
      echo "does not exist";
  
    }
  
  ?&gt;
  </code></pre>
  
  <p>The idea is that on page load it will check if the <code>$_SESSION['promoBar']</code> variable exists, and if it does, return it's value.  Otherwise set a value.</p>
  
  <p>Currently the alert always displays <code>does not exist</code>.  I was expecting it to display <code>does not exist</code> the first time and then <code>closed</code> each time I navigate to a new page.</p>
  
  <p>What have I done wrong?</p>