title: How to pass cakephp formhelper input values to ajax via jquery?
body: <p>I am still new to cakephp, and my attempt is to retrieve the FormHelper's value and pass it via $.ajax() call in jquery. However, by cakephp convention, the name of each field generated by FormHelper will be in the format of <code>data[Model][field]</code>. Now, I want to submit $_POST data in form of cakephp array format. However, I couldn't find a way to do so, because I couldn't find a way to turn name and value attribute into a passable array format.</p>
  
  <p>My attempt was to turn everything into string and try to create a json array. However, I failed to do so, and this method doesn't seem convincing to me too.</p>
  
  <pre><code>function submitEdit(sendurl, formid){
    var dataset = [];
    $('form#'+ formid + ' &gt; input,select').each(function(){
      dataset.push($(this).attr('name') + ':' + $(this).val());
    });
  
    alert(dataset);
    $.ajax({
          type: 'POST',
          data: '{' + dataset + ']',
          url: sendurl,
          success: function(content){
            $('.setting-preview.username').append('&lt;pre&gt;' + content + '&lt;/pre&gt;');
          }
    });
  }   
  </code></pre>
  
  <p>Therefore, how do I pass this as <code>data[Model][field]</code> array to the <code>sendurl</code> controller?</p>