I know that ajax and $ _POST calls have been around a lot lately, however I could not find an answer to my current problem.
In my Javascript, I have a two-dimensional data array:
var postData = new Array(new Array()); postData[0]['type'] = 'grid'; postData[0]['data'] = gridData;
Then I try to send this array to a PHP script:
function export_report_pdf(postData){ console.log(postData); $.post('/ajax/ExportReportPDF.ajax.php',{data: JSON.stringify(postData)}, function(postData){ console.log("Successfully requested report export."); }); }
I tried to get an array in my PHP script: print_r ($ _ POST); var_dump (json_decode (file_get_contents ("PHP: // input")));
but all I get in my $ _POST is an empty two-dimensional array. When I run console.log (postData) at the beginning of my function, there is data.
I also checked $ _REQUEST and tried to remove JSON.stringify.
source share