I have an onclick button that sends a JS object to my PHP via the following AJAX (data is the name of my object):
function send_to_php() {
$(document).ready(function() {
// pt_packet = JSON.stringify(data)
console.log(data)
var request = $.ajax({
url: "post_results.php",
type: 'POST',
data: (data),
success: function(result) {
$("#note").append(result)}})
})}
The problem is when I try to sanitize the data, I the var_dump I get is only the first array and the rest of the information is gone:
array(1) { ["{"Cheif_Complaint":"]=> array(1) { [""Mood issues""]=> string(0) "" } }
Yet this is the information I send:
I've dropped trying to sanitize the data, but now it looks like I'm having to var_export every single array and then use RegEx to get rid of the "array => (" stuff that I'm left with from var_export. Is there not an easier way to sent a JS object and work with it in PHP?