469,923 Members | 1,745 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,923 developers. It's quick & easy.

ajax POST checkbox


I can't seem to find any info on how to pass a list of checked checkboxes through POST method of ajax.

Unlike traditional forms, when you submit a button, a list of selected checkboxes with the same name will allow you to retrieve it at the server side (php in my case).

IS this the only way?

Expand|Select|Wrap|Line Numbers
  1.  param = "selecteditem = " + document.myform.item[0].value;
  2. param+ = "&selecteditem = " + document.myform.item[1].value;
  3. param+ = "&selecteditem = " + document.myform.item[2].value;
Can there be any other ways so that i won't have to manually append each value to the same variable before posting the data?
Nov 24 '07 #1
1 2153
5,390 Expert Mod 4TB
hi ...

since you don't post the page you have to build the querystring for your own ... because you have to identify the values for your own that have to be send to the server ...

but you may write a generic function that you may call in case of building the querystring ... the function should retrieve all input-fields of the page or a specific node ... and always builds a querystring from it ...

kind regards
Nov 24 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by Bill Gower | last post: by
3 posts views Thread by John Mott | last post: by
3 posts views Thread by arggg | last post: by
1 post views Thread by Mark B | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.