Reputation: 6006
I want to send an array to PHP through Ajax.
array = $('.def-mask :checkbox:checked').serialize();
$.ajax({
url: 'ajax/battle.php',
type: 'post',
data: { playerReady: 1, attack: attack, defence: array },
success: function(data) {
alert(data);
}
});
But when I do var_dump($_POST['defence'])
, I get string()
, and not array()
.
Why do I get a string, and not an array?
Upvotes: 0
Views: 607