javascript - 带有 AJAX 的引导表“正在加载,请稍候...”
问题描述
我正在尝试使用带有 ajax 请求的引导表,如下例所示: https ://examples.bootstrap-table.com/#options/table-ajax.html
但是,就像在示例中一样,我的数据没有加载,我只收到一条消息说“正在加载,请稍候......”。我试图通过使用隐藏消息,bootstrapTable('hideLoading');
但后来我只得到“没有找到匹配的记录”。
您有什么想法为什么官方网站上的示例不起作用?
查看一些代码:
function ajaxRequest(params) {
$.ajax({
type: "GET",
url: "getAjax.php",
dataType: "json",
success: function(data) {
params.success({
"rows": data,
"total": data.length
})
},
error: function(er) {
params.error(er);
}
});
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table data-toggle="table" data-detail-view="true" data-detail-view-icon="false" data-detail-view-by-click="true" data-ajax="ajaxRequest" data-detail-formatter="detailFormatter" data-id-field="id" data-page-list="[10, 25, 50, 100, ALL]" class="table table-bordered table-sm table-hover table-responsive"
id="rtcapi">
<thead class="thead-light">
<tr>
<th data-field="id">#</th>
<th data-field="status">Status</th>
<th data-field="ln_demander">Last name</th>
<th data-field="fn_demander">First name</th>
</tr>
</thead>
我试图在 js 函数中 console.log 一些测试,它似乎没有被 html 调用...
谢谢您的回答 !
解决方案
是否添加了 Bootstrap 和 table JS?
<script src="https://unpkg.com/bootstrap-table@1.15.5/dist/bootstrap-table.min.js"></script>
推荐阅读
- camel-rest - apache camel REST 失败并出现 [Error Creating bean with name 'rest-configuration']
- typescript - 如何在我的节点项目中离线运行无服务器?
- java - 如何防止 Spring Boot AOP 删除类型注释?
- c# - 如何将方法委托绑定为组合框的值
- javascript - 在用javascript上传到服务器之前,将文件读取为字节并进行base64编码
- c# - 创建视图和表之间的关系
- vagrant - Vagrant shell provisioner 重复五次
- coldfusion - CFLDAP 名称属性...不能使用结构?
- android - Google 控制台 APK 上传 - 新应用程序失败
- jquery - 如何为数组中的元素获取与这些输入标签关联的文本