title: Retrieving json array with $.ajax GET to php
body: <p>I must be making some simple error somewhere, any help appreciated.</p>
  
  <p>Associative Array</p>
  
  <pre><code>data_form[name] = value;
  </code></pre>
  
  <p>Action</p>
  
  <pre><code>$.ajax({
      type:       "GET",
      cache:      false,
      url:        "../pages/ajax/takeaction.php",
      data:       ({ json: JSON.stringify(data_form) }),
      success: function(data) {
          var message = "Your information has been received!";
  
          $('.element').html(message)
               .hide()
               .fadeIn(1500, function() {                 
                  $(this).append("&lt;br/&gt;"+data)});
      }
  
  });
  </code></pre>
  
  <p>This is what the JSON.stringify data string ends up as</p>
  
  <pre><code>{"action":"register","username":"","email":"","password":"","password2":"","max":"5000000","userfile":""}
  </code></pre>
  
  <p>Then my php file action</p>
  
  <pre><code>$json = $_GET["json"];
  </code></pre>
  
  <p>Gets it and has value</p>
  
  <pre><code>{\"action\":\"register\",\"username\":\"\",\"email\":\"\",\"password\":\"\",\"password2\":\"\",\"max\":\"5000000\",\"userfile\":\"\"}
  </code></pre>
  
  <p>Then try to decode and it returns nothing (using php array foreach etc)</p>
  
  <pre><code>   $array = json_decode($json, true);
  </code></pre>