php - jquery Post problem -
i have code in sending values form php page query lies , sending values using $.post of jquery going good. resulting table , button want button work , 1 of table column has radio button list want button take radio id of perticular row on click button not working please guide me how can code here
my javascript function function searchdetail(searchname) { var textname = searchname + "text"; var inputtext = $('#' + textname).val(); var formname = searchname + "form"; if (inputtext === "") { $('#' + textname).css("border", "2px solid red").fadein(4000); } else { $('#' + textname).css("border", "1px solid #8dd7f6").show(2000); $('#searchbox').fadein(1000); $.post('../search/delete' + searchname + '.php', $('#' + formname).serialize(), function(result) { $('#searchbox').html(result); }) } }
my php code
if ($count == "0") { echo "there no data $search = ".$searchkeyword; } else { $color = 2; echo "<table cellspacing='0px' cellpadding='7px'><thead><tr><th>#</th><th>book id</th><th>book name</th><th>book writer</th><th>book price</th><th>availability</th></tr></thead><tbody>"; while ($row = mysqli_fetch_array($result)) { $checkbook = $row['booktotal'] - $row['bookremain']; if ($checkbook == 1) { $status = "yes"; } else { $status = "no"; } if ($color % 2 == 0) { echo "<tr class='even'><td><input type=radio name=group1 value=".$row['bookid']."></td><td>".$row['bookid']."</td><td>".$row['bookname']."</td><td>".$row['bookwriter']."</td><td>".$row['bookprice']."</td><td>".$status."</td></tr>"; $color = $color + 1; } else { echo "<tr class='odd'><td><input type=radio name=group1 value=".$row['bookid']."></td><td>".$row['bookid']."</td><td>".$row['bookname']."</td><td>".$row['bookwriter']."</td><td>".$row['bookprice']."</td><td>".$status."</td></tr>"; $color = 2; } } echo "</tbody></table><br><input type=button value=delete id=deletebutton onclick='check()'> <script type=text/javascript> function check(){alert(hello);}</script>"; mysqli_close($con); } ?>
my html code
<body> <div id="deleteformtable"> <span id="headerfont">enter information delete book</span><br><br> <form id="booksearchform" name="booksearchform"><label>search book:</label> <input type="text" id="booksearchtext" name="booksearchtext"/> <select id="booksearchoption" name="booksearchoption"><option id="booksearchid">id</option><option id="studentsearchname">name</option></select> <input type="button" value="search" id="booksearch" name="booksearch" onclick="searchdetail(this.id)"></form> </div> <div id="searchbox"> <center><div id="searchloadbox"><img src="../images/loadings.gif" alt="..."></div></center> </div> </body>
ok, think know asking.
you have list of items radio boxes next them, once user clicks 1 , clicks button, want "value" tied radio button.
if case, can use find value of "checked" radio group.
$("#deletebutton").click(function() { var bookid = $("input[@name='group1']:checked").val(); }
Comments
Post a Comment