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

javascript - How to update a get parameter in a url with jquery -

amazon web services - How to determine the state of an AWS instance -

bitmap - Android load image into imageview efficiently -