2016-08-03 67 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

添加HTML代码,此 – Tuhin

回答

0

总结你的代码document准备功能,还结合点击td

$(function(){ 
     $("table td").click(function() { 
      window.location.href = $(this).closest("tr").find("voucher_id").attr("href"); 
     }); 
});