I\'ve been having problems with this code I had spent the last 3 hours digging around and trying to find an answer. As I wasn\'t successful, I will just post the code and as
Although this is an older post I thought I would contribute. I have been sending an associative array same idea an the accepted post I just find it easier to write.
Javascript
postData[0] = 'data!';
postData[1] = 'moar data!';
postData[2] = 'and some data';
$.ajax({
type: 'POST',
url: 'postUrl',
data: { data: postData },
});
PHP
$data = $_POST['data'][0];
$moar_data = $_POST['data'][1];
$and_some_data = $_POST['data'][2];