I try to send a javascript array to php using ajax he's what I did
var d = $("#fromDate").val();
var arr = [];
for(var x=0; x<count_select; x++){
var myArray = new Array();
myArray['val'] = $("select").eq(x).val();
myArray['type'] = $("select").eq(x).attr('type');
myArray['id'] = $("select").eq(x).attr('id');
arr.push(myArray);
myArray = new Array();
}
The array contains elements as I want in a multidimensional array.
But when I send it to php page like this: (Array is not converted yet here's where I want to convert it to send as json)
$.ajax({
type: "POST",
url: "URL_PATH",
data: {"arrar":arr,"date":d},
dataType: "json",
success: function(data) {
alert(data);
}
});
In the network tab i find
date "2017-07-08"
and can't find the array so how can I convert this multidimensional array to an object so I can handle it using php
