我是php html的新手。在我的应用程序中,我有一个按钮和href。我想制作按钮点击弹出窗口和3个单选按钮。我想使用无线电开关更新数据库中的数据而无需任何提交按钮。但我无法打开popover.href用于模态打开和查看数据。
我想当按钮点击弹出窗口时,单选按钮数据进入mysql数据库,但我无法做到。我想要模态和弹出。我怎么能这样做?
$('#exampleModal').on('show.bs.modal', function(event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var recipient = button.data('whatever') // Extract info from data-* attributes
var modal = $(this);
var dataString = 'bclassid=' + recipient;
$.ajax({
type: "GET",
url: "editdata.php",
data: dataString,
cache: false,
success: function(data) {
console.log(data);
modal.find('.dash').html(data);
},
error: function(err) {
console.log(err);
}
});
})
<div class="dataTable_wrapper">
<table class="table table-striped table-bordered table-hover" id="dataTables-example">
<thead>
<tr style="background-color: #d7ccc8;">
<th>CLASS</th>
<th>OPTION</th>
</tr>
</thead>
<tbody>
<?php
$result=mysqli_query($conn,"select bclassid,bclassname,status from bclassinfo");
while($row = mysqli_fetch_array($result)) {
echo "<tr class='odd gradeX'>";
echo "<td align=center><a href='#myModal' data-whatever=" . $row[0] ." data-toggle='modal' data-target='#exampleModal '>" . $row[1] . "</a></td>";
echo "<td><a class='btn btn-small btn-primary'">Edit</a></td>";//button to open popover with three radio button
echo "</tr>";
}
?>
</tbody>
</table>
</div>
<!-- Custom Theme JavaScript -->
<script src="../../dist/js/sb-admin-2.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>