I must be making some simple error somewhere, any help appreciated.
Associative Array
data_form[name] = value;
Action
$.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("<br/>"+data)});
}
});
This is what the JSON.stringify data string ends up as
{"action":"register","username":"","email":"","password":"","password2":"","max":"5000000","userfile":""}
Then my php file action
$json = $_GET["json"];
Gets it and has value
{\"action\":\"register\",\"username\":\"\",\"email\":\"\",\"password\":\"\",\"password2\":\"\",\"max\":\"5000000\",\"userfile\":\"\"}
Then try to decode and it returns nothing (using php array foreach etc)
$array = json_decode($json, true);