I have the below code running to send data as a JSON object
var jdata = JSON.stringify(grid.serialize());
$.ajax({
'type': 'POST',
'url': 'print.php',
'data': jdata, //assuming you have the JSON library linked.
'contentType': "application/json",
'success': function (data) {
alert(data);
},
'error': function (x, y, z) {
alert(x.responseText);
// x.responseText should have what's wrong
}
});
alert(JSON.stringify(grid.serialize()));
Currenty the alert after the ajax function prints
[{"id":"1","col":"1","row":"1","size_y":"1","size_x":"1"},{"id":"2","col":"2","row":"1","size_y":"1","size_x":"1"}]
On the receiving page I am using <?php print_r($_POST) ?>
to see what the page is being sent and it keeps outputting
Array
(
)
I must be missing something simple but have been unable to figure out what. Maybe a fresh set of eyes will see a simple mistake I have made.