【发布时间】:2017-03-16 04:20:26
【问题描述】:
我有数据表 json 名称 = table_a.php 我在那个文件上有超链接..
我可以将数据表显示给
<table data-url="table_a.php"></table>
在那一栏有超链接。我想处理那个到 ajax 的链接。
<script>
$(document).ready(function() {
//$(document).on("click", "#stats", function (e) {
$('#stats').click(function(e) {
alert("a");
e.preventDefault();
$.ajax({
alert("ab");
url: 'update_process.php',
data: $(this).serialize(),
dataType: 'json',
success: function(status) {
var datanya = JSON.parse(JSON.stringify(status));
$('#table').bootstrapTable('refresh', {url: 'table_a.php'});
}
});
return false;
});
})
</script>
我尝试点击链接,但从未显示警报。
table_a.php:
<?php
header('content-type:application/json');
include '../koneksi.php';
$select = mysql_query("select * from tb_pemesanan where no_meja='$_GET[meja]'");
$row=array();
while($row=mysql_fetch_array($select))
{
$select1 = mysql_query("SELECT * FROM tb_pemesanan where id_pemesanan='$row[id_pemesanan]' AND status='Sedang di proses'");
$status='0';
if(mysql_num_rows($select1)== 0) {
$status="<a class='btn btn-success' href='#'><b>Sudah di antar <span class='glyphicon glyphicon-ok'></span></b></a>";
}else{
$status="<a id='stats' class='btn btn-primary' href='proses.php'>
<b>Sedang di proses <span class='glyphicon glyphicon-hourglass'></span></b></a>";
}
$arrayx=array( "status"=>$status );
$rows[] = $arrayx;
}
echo json_encode($rows);
?>
【问题讨论】:
-
请出示您的
PHP代码。 -
我添加了 table_a.php