Pass PHP Array via jQuery Ajax

后端 未结 5 1034
粉色の甜心
粉色の甜心 2021-01-22 13:40

I\'ve got a php array:

$toField = explode(\",\", $ids);  //Which looks something like \'24,25,26,29\'

I want to pass this array via jQuery AJAX

5条回答
  •  梦谈多话
    2021-01-22 13:56

    .. etc .. .. rest of you're form ..

    jQuery change the data: .. part to:

    data: $('#myform').serialize()
    

    Then in you're PHP:

    foreach ( $_POST [ 'to' ] as $num )
    {
     // do something with $num;
    }
    

    Something like this an option?

提交回复
热议问题