How to pass a Javascript Array via JQuery Post so that all its contents are accessible via the PHP $_POST array?

前端 未结 4 541
盖世英雄少女心
盖世英雄少女心 2020-11-30 01:29

How can I pass a Javascript Array via JQuery Post so that all its contents are accessible via the PHP $_POST array?

Please show an example of code that would do the

4条回答
  •  眼角桃花
    2020-11-30 02:33

    Here it goes an example:

    $.post("test.php", { 'choices[]': ["Jon", "Susan"] });
    

    Hope it helps.

提交回复
热议问题