thanks anyway i foun a way to do it through this: var myFunction = function() { $("#myButton").click(function() { if (confirm("are you sure?")){ arrayCheckBox = new Array; $("input:checked").each(function(id) { myVar = $("input:checked").get(id); arrayCheckBox.push(myVar.value); }); $.ajax({type: "POST", url: "myScript.php", data: "checkBox="+arrayCheckBox, success: function(){ //alert("success"); $("#cont1").empty(); $("#cont2").fadeOut().empty(); $("#cont3").load("mpScript2.php", function(){ myFunction2(); }); $("#cont4").fadeIn(300).fadeTo(300, 1).fadeOut(300); } }); } else { alert("not deleted"); } }); }
hope it can help eveyone else vitto On Feb 14, 11:27 pm, andrea varnier <[EMAIL PROTECTED]> wrote: > 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 :)