Please have a look at the following code:
$("#saveButton").click(function(){
$this = $("#tableData").find("input:checked").parent().parent();
tea = $this.find(".teaCls").text();
$.ajax({
type: "POST",
url: "chkSelectedValues.php",
data: "tea=" + tea,
success: function(msg){
$("#theField").html(msg);
}
});
});
Now if multiple checkboxes are selected, tea and flower end up concatenating the texts from all those fields. If two checkboxes are selected and one contains the word some and the other one contains the word text, then finally the tea variable gets the value: sometext. But I want tea to be an array containing these values (in this case some and text) since I need to pass them in AJAX request and want to catch easily in chkSelectedValues.php
Structure:
<table #tableData>
<tr>
<td .teaCls></td>
<td> Checkbox here</td>
</tr>
<tr>
.....
How can I do this? Thanks in advance.
Yeah. Solved it.. thanks everybody for help.
now
mdis my hero!