I have a table inside a form. It has two columns, the first one is a checkbox and the second is an input.
Here its structure:
<table>
<tr>
<td>
<input type="checkbox" name="choose" id="choose" class="choose">
</td>
<td>
<input type="text" name="item" id="item" class="item" >
</td>
</tr>
</table>
It is filled with info from my database so it may have several rows.
The form is submitted via a javascript function to a js file and then, thanks to jQuery’s ajax, all the parameters go to my controller php file.
As I want to send to my php all the values form the text input, in my js file I do:
var arrayItem= [];
$(".item").each(function(){
arrayItem.push($(this).val());
})
params += '&items='+ arrayItem;
.
.
//So I can do:
$.ajax ({
url: myPHPUrl,
data: params,
type: "POST",
async:false,
success: function (data, textStatus)
{
}
});
Now I need to do the same with the checkboxes but I don’t know how to proceed.
Can anyone please help me with it?
Thanks very much!
You can try this: