jquery - How to click on a primary key and have that data sent to another page? -
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js" type="text/javascript"> </script> <script type="text/javascript"> $(document).ready(function(){ $("#stuff").on("click",function(){ //var thing=$(this).text("td:first"); var tag=$(this).find("td:first").html(); var thing=$("tag").text(); alert(thing); //var thing=$(this).parent().siblings(":first").text(); window.location.href='thing.jsp?thing=' + thing; }); }); </script> <form action="relay" method="get"> <table border="2" id="stuff"> <tr> <td>id</td> <td>lion</td> <td>tiger</td> <td>libra</td> <td>ox</td> </tr> </form>
my code table above , jquery function. trying click primary key of (first column of each row) each row , send data webpage in order perform sql query. have been able work first row , not other rows. whenever click on other primary key, sends primary key column name id. not helpful query not able pull data attached primary key. have insight on how go doing this.
Comments
Post a Comment