我正在使用jQuery-bootgrid。在最后一栏中,我有两个用于编辑/删除行内容的按钮。 删除效果不错,但是当我要编辑内容时,模式不会出现 idk还有什么可做大声笑:(
这是我具有的功能
funciones.js
let mainArrSorted = [['Mary', 17, 'student'], ['john', 27, 'teacher'], ['Jane', 40, 'police']];
Fetch_single.php
$(document).on("loaded.rs.jquery.bootgrid", function()
{
productTable.find(".update").on("click", function(event)
{
var id_matricula = $(this).data("row-id");
$.ajax({
url:"fetch_single.php",
method:"POST",
data:{id_matricula:id_matricula},
dataType:"json",
success:function(data)
{
$('#productModal').modal('show');
$('#nomAlu').val(data.nomAlu);
$('#apellidoP').val(data.apellidoP);
$('#apellidoM').val(data.apellidoM);
$('#id_carrera').val(data.id_carrera);
$('.modal-title').text("Edit Product");
$('#id_matricula').val(id_matricula);
$('#action').val("Edit");
$('#operation').val("Edit");
}
});
});
});
HTML index.php
<?php
//fetch_single.php
include("connection.php");
if(isset($_POST["id_matricula"]))
{
//$output = array();
$query = "SELECT * FROM alumnos WHERE id_matricula =
'".$_POST["id_matricula"]."'";
$result = mysqli_query($connection, $query);
while($row = mysqli_fetch_array($result))
{
$output["id_matricula"] = $row["id_matricula"];
$output["nomAlu"] = $row["nomAlu"];
$output["apellidoP"] = $row["ApellidoP"];
$output["apellidoM"] = $row["ApellidoM"];
$output["id_carrera"] = $row["id_carrera"];
}
echo json_encode($output);
}
?>