title: Post request from JQuery to CakePHP
body: <p>I am creating a web application that uses CakePHP as the back end and JQuery as the front end. In order to communicate with the server, I wanted to make GET and Post requests from JQuery using ajax. Here is what I have right now:</p>
  
  <pre><code>function submit_registration(fname, lname, email, pass)
  {
    var arr = { data: {User: { fname: fname, lname: lname, email: email, password: pass }}};
  
    $.post('http://localhost/cake2/users/add', JSON.stringify(arr), function(response){
    alert(response);
    })
  }
  </code></pre>
  
  <p>That is in JQuery. Here is the add action in CakePHP:</p>
  
  <pre><code>public function add()
  {   
      $this-&gt;layout = null ;
  
      if ($this-&gt;request-&gt;is('post'))
      {
          $data = $this-&gt;request-&gt;input('json_decode');
          $this-&gt;User-&gt;create();
  
          if ($this-&gt;User-&gt;save($data))
          {
              $this-&gt;set('data', "success");
              $this-&gt;render('/General/JsonMode2/');
          }
          else
          {
              $this-&gt;set('data', "failure to save");
              $this-&gt;render('/General/JsonMode2/');
          }
      }
      else
      {
          $this-&gt;set('data', "failure to post");
          $this-&gt;render('/General/JsonMode2/');
      }
  }
  </code></pre>
  
  <p>It renders as JSON back to the front end. My problem is, nothing happens when I submit the request. I put alerts to ensure that the submit_registration function was being called. Can anyone give me a clue as the what is going on?</p>