Send array with ajax request to php

前端 未结 5 848
逝去的感伤
逝去的感伤 2021-02-08 03:37

I created array like this [\"9\", \"ques_5\", \"19\", \"ques_4\"]. Now I want to send it from JS to PHP but I\'m not getting proper results. My JS code is:

5条回答
  •  被撕碎了的回忆
    2021-02-08 04:05

    If you want to send key value pairs, which is what I am seeing, it would be better to use a PHP JSON library (like this one... http://php.net/manual/en/book.json.php)

    Then you can send actual key value pairs, using JSON format like... {"ques_5" : "19", "ques_4": "19"}

提交回复
热议问题