dongyuan2652
2019-02-04 13:30
浏览 57
已采纳

使用Ajax在PHP中检索数组

I need to send an array using Ajax to a script PHP.

Javascript:

$.ajax({
    type: "POST",
    url: "vendas_funcoes.php",
    data: {"data": arrayItens},
    success: function(msg){
        console.log("ok");
    }
});

I already tried to use te example below, but it doesn't work.

vendas_funcoes.php:

<?php
    $data = stripslashes($_POST);

    // usar foreach para ler o array
    foreach($data as $d){
        echo $d;
    }
?>

How do I receive this array im my PHP script to manipulate him ? Aparently the code below sends the array empty.

Excuse me for possible grammar mistakes, i'm brazilian.

3条回答 默认 最新

相关推荐 更多相似问题