How to send an array with jquery to php script? -


i sending array php script using ajax call, not able access array in php.

here code:

seats = ["s4","s6","s9","s24"]; sendbookedseats(seats);  function sendbookedseats(seats){     console.log(seats);     $.ajax({       type: "post",       url: "index.php",       data: {         'seats' : seats,       }     }) } 

how access array seats in php script?

send data json:

seats= ["s4","s6","s9","s24"]; sendbookedseats(seats);    function sendbookedseats(seats){     console.log(seats);     $.ajax({       type: "post",       url: "index.php",       data: {         'seats' : json.stringify(seats),       }     }) } 

php:

json_decode($_post["seats"]); 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -