我正在通过ajax将数组发送到PHP。如何从PHP获取数组?
$('#ownerslist').DataTable({
"columnDefs": [
{ "targets": [1, 2, 3, 5, 7, 8, 9, 10, 11, 12, 13], "searchable": false },
{ "visible": false, "targets": groupColumn }
],
"paging": true,
"lengthChange": true,
//"searching": true,
"ordering": false,
"info": true,
"autoWidth": true,
"drawCallback": function (settings) {
var api = this.api();
var rows = api.rows({ page: 'current' }).nodes();
var last = null;
api.column(groupColumn, { page: 'current' }).data().each(function (group, i) {
if (last !== group) {
$(rows).eq(i).before(
'<tr class="group"><td colspan="16">' + group + '</td></tr>'
);
last = group;
}
});
}
});
我尝试了这个,但是没有用
$('.send-image').on('click', function() {
$.ajax({
type:"POST",
url:"sendimages.php",
data: {
images: imgArr
},
success: function(data) {
console.log(data);
},
error: function(e) {
console.log(e);
}
});
});
答案 0 :(得分:3)
替换
$images = $_POST['imgArr'];
使用
$images = $_POST['images'];
因为索引images
来自此处:
data: {
images: imgArr
}