Ich habe eine Tabelle mit dynamischen Werten und ausgeblendeten Eingabefeldern und dynamischen Kontrollkästchen. Kontrollkästchen haben die gleichen Klassennamen. Wenn ich auf ein bestimmtes Kontrollkästchen klicke, möchte ich, dass die Eingabewerte aus dieser bestimmten Zeile an Ajax gesendet werden.Checkbox in einer dynamischen Tabelle mit dynamischen Eingabefeldern
Unten finden Sie den Code für dynamische Tabelle,
<table id="table">
<thead>
<tr>
<th >Sl.no</th>
<th >Owner Name</th>
<th >Contact Number</th>
<th class="text-center" data-title="Action">Action</th>
</tr>
</thead>
<tbody id="responsive-table-body">
<?php
$owner=mysql_query("select id,tmp_id,name,phone,activate from pgowner where active='1'");
if(mysql_num_rows($owner)){
$i=0;
while($owner1=mysql_fetch_array($owner)){
$id=$owner1['tmp_id'];
?>
<tr>
<td><span class="label label-default"><?php echo ++$i; ?></span></td>
<td>
<a href='viewprofile?id=<?php echo $id; ?>' target='_blank' style='color:blue;text-decoration:underline;'><?php echo $owner1['name']; ?></a>
<input type="hidden" name="ownerid" value="<?php echo $owner1['tmp_id']; ?>" id="ownerid" />
</td>
<td>
<?php echo $owner1['phone']; ?>
</td>
<td>
<input type="checkbox" name="activate[]" class="activate" id="activate" />
</td>
</tr>
<?php } }
?>
</tbody>
</table>
Hier ist der Ajax-Code den Wert aus der Reihe zu holen, in dem Kontrollkästchen aktiviert ist.
Ich kann den Eingabewert nicht aus der Zeile abrufen, in der das Kontrollkästchen aktiviert ist. Bitte helfen Sie.
generiert HTML sieht wie folgt aus,
<table id="table" >
<thead>
<tr>
<th >Sl.no</th>
<th >Owner Name</th>
<th >Contact Number</th>
<th >Action</th>
</tr>
</thead>
<tbody id="responsive-table-body">
<tr >
<td ><span class="label label-default">1</span></td>
<td>
<a href="viewprofile?id=EdXzrq" target="_blank" style="color:blue;text-decoration:underline;">Name1</a>
<input type="hidden" name="ownerid" value="EdXzrq" id="ownerid">
</td>
<td>
9731269342
</td>
<td>
<input type="checkbox" name="activate[]" class="activate" id="activate">
</td>
</tr>
<tr >
<td ><span class="label label-default">2</span></td>
<td>
<a href="viewprofile?id=RowMpg" target="_blank" style="color:blue;text-decoration:underline;">Name2</a>
<input type="hidden" name="ownerid" value="RowMpg" id="ownerid">
</td>
<td>
7760807087
</td>
<td>
<input type="checkbox" name="activate[]" class="activate" id="activate">
</td>
</tr>
</tbody>
</table>
können Sie die generierten HTML- –