Hi,
I am working on improvements for a web app.
It currently submits checkboxes to a php script for processing by
simply submitting the form naturally. However i require this action
using a ajax post to save bandwidth etc. and im struggling to work out
how to do this.

Im familiar with normal ajax posts using jquery but here i need to
post an array.

Simplified a little this is what i have.

<input type="checkbox" name="ckdOrd[]" value="1" id="order_1"  />
<input type="checkbox" name="ckdOrd[]" value="2" id="order_2"  />
<input type="checkbox" name="ckdOrd[]" value="3" id="order_3"  />
<input type="checkbox" name="ckdOrd[]" value="4" id="order_4"  />

It used to build an array ckdOrd[] and post to a php script with a
loop for processing. It needs to post the order numbers as an array
for processing.

Is there a way to simply create the same post using ajax jQuery?

I would prefer this as that would mean i dont have to make major
changes to the php script.

the php simply does something like this

//get posted array
$ckdOrd=$_REQUEST['ckdOrd'];

foreach($ckdOrd as $key => $ord_no){
   //update mysql here
}

I have seen other posts but they all seem to be cluttered and
unhelpful.

Is it correct to avoid the name attribute and simple find each checked
checkbox using jquery? or am i going down the wrong path.

Reply via email to