I'm not sure if this question has been asked before, so please note if it's duplicate.
The top line is a PHP merged array that I'm trying to send in AJAX to another page.
I'm having trouble finding what goes in the "?" or how to format it.
<?php $_SESSION['pdfData'] = array_merge_recursive($count, $qty); ?>
$.ajax({
type: "POST",
url: "indexMenu-sm-pdf.php",
data: {
?
},
dataType: "JSON",
success: function(data){
console.log("Good.");
},
error: function(jqXHR, textStatus, errorThrown) {
console.log(textStatus, errorThrown);
}
});
I understand that the built-in function json_encode() but i lack the know-how. And I've been reading about serialization. Is one better than the other?
My main questions are:
What goes into the "?" as $_Session['pdfData'] can not be sent.
And
Is there a difference is using json_encode vs. serialization for this issue?
</div>