2016-08-03 7 views
0
<script type="text/javascript"> 
function getvoucher(id){ 
    $.get("http://inactive/test.php?id=" + id, function(data,status){ 
     return data; 
    }); 
} 
</script> 
<script type="text/javascript"> 
$("tr").click(function() { 
    window.location.href = $(this).find("voucher_id").attr("href"); 
}); 
</script> 

コード内で、テーブルの各行をクリック可能にし、その行をクリックすると、データに伝票IDが送信されます。データをダイアログボックスに表示します。しかし、私はそれを行う方法が不明です。idで表示する関数を呼び出す

+3

をクリックしても、documentレディ機能でコードをラップ – Tuhin

答えて

0

このためのHTMLコードを追加バインドテーブルにtd

$(function(){ 
     $("table td").click(function() { 
      window.location.href = $(this).closest("tr").find("voucher_id").attr("href"); 
     }); 
}); 
関連する問題