버튼을 선택하면 행에 테이블 데이터를 가져 오는 데 문제가 있습니다. 나는 두 개의 버튼을 승인하고 거부하고 어떤 버튼 사용자가 쿼리를 사용하여 데이터를 집어 넣을 것인지를 기반으로합니다. 행 번호를 가져 와서 행 데이터가 아닌 데이터를 가져올 수 있습니다. 나는 이드와 테스터를 얻을 필요가있다. 여기 해당 행의 버튼을 클릭하여 jquery를 사용하여 행 데이터 가져 오기
내가 여기<table id="mytable" width="100%">
<thead>
<tr>
<th>ID</th>
<th>Tester</th>
<th>Date</th>
<th>Approve</th>
<th>Deny</th>
</tr>
</thead>
<tbody>
<tr class="test">
<td class="ids">11565 </td>
<td class="tester">james</td>
<td>2012-07-02 </td>
<td><Button id="Approved" type="submit" >Approved</button>
</td>
<td><Button id="deny_0" type="submit" >Denied</button>
</td>
</tr>
</tbody>
</table>
은 TR과 TD 번호를 내 자바 스크립트입니다 무엇을하지만 난 내가 필요한 것을 얻기 위해 그것을 사용하는 방법을 잘 모르겠습니다
$(document).ready(function() {
/*$('#cardsData .giftcardaccount_id').each(function(){
alert($(this).html());
}); */
$('td').click(function(){
var col = $(this).parent().children().index($(this));
var row = $(this).parent().parent().children().index($(this).parent());
alert('Row: ' + row + ', Column: ' + col);
// alert($tds.eq(0).text());
console.log($("tr:eq(1)"));
// $("td:eq(0)", this).text(),
});
});