title: CakePHP sessions not working
body: <p>I am trying to save data in the session with cakePHP. I have read the documentation and many examples online but I can't seem to save the data in the session.</p>
  
  <p>In my controller I have added the session write function:</p>
  
  <pre><code>public function take(){
      if(array_key_exists('option', $this-&gt;request-&gt;data)){
          foreach($this-&gt;request-&gt;data['option'] as $cmd =&gt; $options){
              foreach($options as $cmd =&gt; $option){
                  $buildCmnd = '-1 RENDERER*'.$this-&gt;request-&gt;data['Playlist']['layer'].'*TREE*$master*SCRIPT*INSTANCE*externalCommand SET '.$this-&gt;request-&gt;data['Playlist']['el'].' '.$cmd.' text={'.$option.'}';
                  $this-&gt;send($buildCmnd);
              }
          }
      }
      $this-&gt;Session-&gt;write('TakenCommand', array( $this-&gt;request-&gt;data['Playlist']['el'] ) );
  
      $this-&gt;autoRender = false;
  }
  </code></pre>
  
  <p>I am calling the action via jquery ajax:</p>
  
  <pre><code>$("#inputTake").click(
      function()
      {                
          jQuery.ajax({
              type:'POST',
              async: true,
              cache: false,
              url: '/Controller/take',
              success: function(response) {
                  jQuery('#resultField').val(response);
              },
              data:jQuery('form').serialize()
          });
          return false;
      }
  );
  </code></pre>
  
  <p>Because I am using ajax, I created an element that I call to check the session. This is the contents of the element:</p>
  
  <pre><code>&lt;pre&gt;
  &lt;?php print_r($this-&gt;Session-&gt;read());?&gt;
  &lt;/pre&gt;
  </code></pre>
  
  <p>But the session variable "TakenCommand" does not appear in the output.</p>
  
  <p>I have added the Session component to the AppController.php file:</p>
  
  <pre><code>public $components = array('Session');
  </code></pre>
  
  <p>And I have changed the core.php file session default from "php" to "cake" and back, but neither seem to help.</p>
  
  <p>Any suggestions would be greatly appreciated!</p>
  
  <hr>
  
  <p>Some answer I have seen suggest to set 'checkAgent' => false in core.php but this doesn't help either.
  In CakePHP 1.x is was possible to set the security level to medium which would resolve the problem, but this option is not available in 2.x.</p>