开发者

passing array post values jquery ajax to php

开发者 https://www.devze.com 2023-04-10 22:00 出处:网络
I spend my all day in searching of this sol开发者_C百科utions but i didn\'t find any proper way to do this.

I spend my all day in searching of this sol开发者_C百科utions but i didn't find any proper way to do this. i am beginner with jquery need code help.

i have a dynamic table in a form which will send bed details to php. its diagram is like this. numbers below user choose from select dropdown box.

Rooms     | King Bed | Queen Bed | Child Bed
--------------------------------------------------
Room Name |   1      |    0      |   0
Room Name2|   0      |    1      |   0
Room Name3|   0      |    0      |   2

its not a single form many of other inputs are before it and after it. so i dont think so we can use serialize() with jquery etc.. the thing which i really hate in jquery ajax is we can't pass $_POST['txt'] array of form to php. need you help with how can i pass each room detail to php.

waiting for positive response.

thank you


There's no reason you can't post arrays through ajax. You just can't use a native object, pass a string instead.

$.post('mypage.php', 'txt[]=a&txt[]=b&txt=c')

More info at http://api.jquery.com/jQuery.post/

NOTE: You may need to escape the [ and ] which become %5B and %5D, respectively.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号