sending javascript array to external php file using POST
- by user1472224
I am trying to send a javascript array to an external php page, but the only thing the php page is picking up is the fact that I am sending array, not the actual data within the array.
javascript -
var newArray = [1, 2, 3, 4, 5];
$.ajax({
type: 'POST',
url: 'array.php',
data: {'something': newArray},
success: function(){
alert("sent");
}
});
External PHP Page -
<?php
echo($_POST['something']));
?>
I know this question has been asked before, but for some reason, this isn't working for me. I have spent the last couple days trying to figure this out as well. Can someone please point me in the right direction.
current output (from php page) -
Array (thats all the page outputs)