title: cakephp multiple ajax request session problems
body: <p>I have a problem with the handling of sessions in Cakephp. I make two request. The first request submits a form and many things happens. The second request is an ajax-request that want to get to know the status of the first request.
  Therefor I write the status into a session variable. I google a lot and I know it's possible that I get a valid return for each ajax-status-request. The problem is, that the variable in the session is always the last status of the request before. Here an example:</p>
  
  <p>Frist submit</p>
  
  <p>Ajax-Status-Request 1: status 1</p>
  
  <p>Ajax-Status-Request 2: status 1</p>
  
  <p>...</p>
  
  <p>Ajax-Status-Request 10: status 1</p>
  
  <p>End (status should be 10)</p>
  
  <p>Second submit</p>
  
  <p>Ajax-Status-Request 1: status 10</p>
  
  <p>Ajax-Status-Request 2: status 10</p>
  
  <p>...</p>
  
  <p>Ajax-Status-Request 10: status 10</p>
  
  <p>End (status should be 10)</p>
  
  <p>In cakephp i tried to configure 'php' and 'cake'. But if I use this configuration each ajax-request was waiting until the submit was finished. Now i tried "cache".</p>
  
  <pre><code>    Configure::write('Session', array(
      'defaults' =&gt; 'cache'
  ));
  </code></pre>
  
  <p><em>Controller of the form submit</em></p>
  
  <pre><code>$this-&gt;Session-&gt;write('request_status', "start");
  sleep(5);
  for($i =1;$i&lt;500000;$i++){
      if($i == 1000){
          $this-&gt;Session-&gt;write('request_status', $this-&gt;Session-&gt;read('request_status').$i);
      }
      if($i == 7000){
          $this-&gt;Session-&gt;write('request_status', $this-&gt;Session-&gt;read('request_status').$i);
      }
  }
  $this-&gt;Session-&gt;write('request_status', "ende");
  </code></pre>
  
  <p><em>Ajax-status-request</em></p>
  
  <pre><code>public function checkRequestStatus(){
      $this-&gt;respond($this-&gt;Session-&gt;read('request_status'), true);
  }
  </code></pre>
  
  <p><em>Ajax-Code</em></p>
  
  <pre><code>$.ajax({
              type: "POST",
              url:"&lt;?php echo Router::url(array('controller'=&gt;'AjaxRequestStatus','action'=&gt; 'checkRequestStatus', 'plugin' =&gt; ''));?&gt;",
              async: false,
              success: function(data){
                  $('#popup_content').append(data+ "&lt;br /&gt;");
              }
           });
  </code></pre>
  
  <p>Ok, I expect that also other people was able to create a multiple request and want to get know the status of the first request. What is my mistake? Is it a configuration problem?</p>
  
  <p>Greetz</p>
  
  <p>V</p>