By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,299 Members | 1,247 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,299 IT Pros & Developers. It's quick & easy.

ajax POST checkbox

P: 7
guys,

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
Share this Question
Share on Google+
1 Reply


gits
Expert Mod 5K+
P: 5,390
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.