I have this jquery code:
$(".cashOutButton").click(function(e){
e.preventDefault();
var sendArray=[{'value': '123', 'type': 'Buy_Order_ID'},
{'value': '44.20', 'type': 'Set_Price'},
{'value': 'John', 'type': 'seller_Name'},
{'value': 'S', 'type': 'Sell_Type'}
];
var sendData = {'sendArray': sendArray};
$.getJSON('addToSession.php',sendData,function(data){
console.log(data);
});
})
and this php code - addToSession.php (it's just to test if it's working, the final code will be different):
<?php
print_r($_GET['sendArray']);
?>
It doesn't work. Nothing comes back. My question is, can I send an array of objects to $.getJSON? What other solutions are there to send arrays? It doesn't have to be array of objects, it could be array of arrays, if that would work.