title: simple json response with cakephp
body: <p>I trying to pass some json to a controller in cakePHP 2.5 and returning it again just to make sure it is all going through fine.</p>
  
  <p>However I getting no response content back. Just a 200 success. From reading the docs I am under the impression that if I pass some json then the responseHandler will the return json as the response.</p>
  
  <p>Not sure what I am missing.</p>
  
  <p>Data being passed</p>
  
  <pre><code>var neworderSer = $(this).sortable("serialize");
  </code></pre>
  
  <p>which gives</p>
  
  <pre><code>item[]=4&amp;item[]=3&amp;item[]=6&amp;item[]=5&amp;item[]=7 
  </code></pre>
  
  <p>appController.php</p>
  
  <pre><code>public $components = array(
      'DebugKit.Toolbar', 
      'Search.Prg', 
      'Session', 
      'Auth',
      'Session',
      'RequestHandler'
  );
  </code></pre>
  
  <p>index.ctp</p>
  
  <pre><code>    $.ajax({
          url: "/btstadmin/pages/reorder",
          type: "post",
          dataType:"json",
          data: neworderSer,
          success: function(feedback) {
              notify('Reordered pages');
          },
          error: function(e) {
              notify('Reordered pages failed', {
                  status: 'error'
              });
          }
      });
  </code></pre>
  
  <p>PagesController.php</p>
  
  <pre><code>public function reorder() {
  
      $this-&gt;request-&gt;onlyAllow('ajax');
      $data = $this-&gt;request-&gt;data;
      $this-&gt;autoRender = false;
      $this-&gt;set('_serialize', 'data');
  
  }
  </code></pre>
  
  <p>UPDATE:
  I have now added the following to the routes.php</p>
  
  <pre><code>    Router::parseExtensions('json', 'xml');
  </code></pre>
  
  <p>and I have updated my controller to</p>
  
  <pre><code>    $data = $this-&gt;request-&gt;data;
  
      $this-&gt;set("status", "OK");
      $this-&gt;set("message", "You are good");
      $this-&gt;set("content", $data);
      $this-&gt;set("_serialize", array("status", "message", "content"));
  </code></pre>
  
  <p>All now works perfectly.</p>