答案 0 :(得分:0)
你拼错了,这就是为什么它没有关闭'ALERT'
下面:
<?php
$page = $_GET['page'];
$limit = $_GET['rows'];
$sidx = $_GET['sidx'];
$sord = $_GET['sord'];
$result = $mysqli->query("SELECT COUNT(*) AS count FROM users");
$row = mysqli_fetch_array($result,MYSQLI_ASSOC);
$count = $row['count'];
if( $count > 0 && $limit > 0) {
$total_pages = ceil($count/$limit);
} else {
$total_pages = 0;
}
if ($page > $total_pages) $page=$total_pages;
$start = $limit*$page - $limit;
if($start <0) $start = 0;
$SQL = "SELECT * FROM users ORDER BY $sidx $sord LIMIT $start , $limit";
$result = $mysqli->query( $SQL );
$i=0;
$responce = new stdClass();
$responce->page = $page;
$responce->total = $total_pages;
$responce->records = $count;
while($row = mysqli_fetch_array($result,MYSQLI_ASSOC)) {
$responce->rows[$i]['id']=$row['id_user'];
$responce->rows[$i]['cell']=array($row['id_user'],$row['firstname'],$row['lastname'],$row['username'],$row['level']);
$i++;
}
echo json_encode($responce);
?>
错误:
$(function () {
"use strict";
jQuery("#list2").jqGrid({
url:'users_grid_load_data.php?q=2',
dataType: "Json",
mtype: 'Get',
colNames:['Id','First Name', 'Last Name', 'Username','Level'],
colModel:[
{name:'id_user',index:'id_user', width:55},
{name:'firstname',index:'firstname', width:90},
{name:'lastname',index:'lastname', width:90},
{name:'username',index:'username', width:90},
{name:'level',index:'level', width:80}
],
rowNum:10, rowList:[10,20,30],
pager: '#pager2',
sortname: 'id_user',
viewrecords: true,
sortorder: "asc",
height:"auto",
width:"auto",
caption:"LIST OF USERS"
});
jQuery("#list2").jqGrid('navGrid','#pager2',{edit:false,add:false,del:false});
});
不是<div class="alert alert-danger fade in">
<a href="#" class="close" data-dissmiss="alert" aria-label="close" >×</a>Don't forget Ramsey's Birthday
</div>
使用此:
data-dissmiss="alert" // DISMISS