$('#button').live('click', function() {
values_array = [];
$('.field').each(function() {
values_array.push = $(this).val();
});
$.ajax({
url: 'page.php',
data: { array_a : values_array },
type: 'POST',
success: function(data) {
$('#div').html(data);
}
});
});
//page.php
echo $_POST['array_a'] . "<br/>"; //The line break echos, but nothing else
A.) Do I need to iterate through each class with $.each
in order to create a proper array, and
B.) Why doesn't php echo it?
array_a
in brackets -data: { "array_a" : values_array }
? – Karo May 13 at 11:43print_r($_POST)
? – Karo May 13 at 11:45Array ( )
, as expected – Norse May 13 at 11:47