title: Posting JSON with jquery ajax to PHP
body: <p>I have a simple php file that decode my json string, passed with ajax, and stamp the result, but I can't keep the <code>$_POST</code> variable, why???</p>
  
  <p>I try to inspect with fireBug and I can see that the POST request is sent correctly, when the <strong>php</strong> script is called, he respond Noooooooob to me, it seem any POST variable is set.</p>
  
  <p>All I want is to have my array =)</p>
  
  <p>JSON String generated by <code>JSON.stringify</code>:</p>
  
  <pre><code>[
     {
        "id":21,
        "children":[
           {
              "id":196
           },
           {
              "id":195
           },
           {
              "id":49
           },
           {
              "id":194
           }
        ]
     },
     {
        "id":29,
        "children":[
           {
              "id":184
           },
           {
              "id":152
           }
        ]
     },
     ...
  ]
  </code></pre>
  
  <p>JavaScript</p>
  
  <pre><code>$('#save').click(function() {
    var tmp = JSON.stringify($('.dd').nestable('serialize'));
    // tmp value: [{"id":21,"children":[{"id":196},{"id":195},{"id":49},{"id":194}]},{"id":29,"children":[{"id":184},{"id":152}]},...]
    $.ajax({
      type: 'POST',
      url: 'save_categories.php',
      dataType: 'json',
      data: {'categories': tmp},
      success: function(msg) {
        alert(msg);
      }
    });
  });
  </code></pre>
  
  <p>save_categories.php</p>
  
  <pre><code>&lt;?php
    if(isset($_POST['categories'])) {
      $json = $_POST['categories'];
      var_dump(json_decode($json, true));
    } else {
      echo "Noooooooob";
    }
  ?&gt;
  </code></pre>