On 14 Feb, 16:59, hcvitto <[EMAIL PROTECTED]> wrote:
>   data: what should i write here??? how should i send my
> arrayCheckBox values??

you have to use a map, an object containing name: value pairs.
the names will be the names of the variables that the php script is
expecting to receive.
so if the script is wating for $_POST['checkBox1'],
$_POST['checkBox2], etc...
your object will look like this:

{'checkBox1': 'true', 'checkBox2': 'true'....}

to put an array into an object, the syntax is

{'checkBox': [x, y, z, ...]}

but I've never tried that, and I don't know if it works. you can try.
just one note.
these two lines:

arrayCheckBox = new Array;
arrayCheckBox = $("#selezionaCancella input:checked");

don't work as you would expect. that is to say arrayCheckBox is not an
array at the end.
this selector $("#selezionaCancella input:checked") returns a jQuery
object, which is not an array :/
one way to get around that could be this.

var toBeSent = {checkBox: []};
$('#selezionaCancella:checkbox').each(function(index){
      if ($(this).is(':checked')) toBeSent.checkBox[index] = true;
          else toBeSent.checkBox[index] = false;
});

$.ajax({url:...,
           type: 'post',
           data: toBeSent,

....it's very late and I'm a bit tired, so maybe I wrote some cagate,
but you should get the idea, I hope :)

Reply via email to