Tôi có một phương thức Bootstrap được khởi chạy từ một liên kết. Trong khoảng 3 giây, nó chỉ nằm ở đó trống, trong khi truy vấn AJAX lấy dữ liệu từ cơ sở dữ liệu. Làm cách nào để triển khai một số loại chỉ báo tải? Twitter bootstrap có cung cấp chức năng này theo mặc định không?
CHỈNH SỬA: Mã JS cho phương thức
<script type="text/javascript">
$('#myModal').modal('hide');
$('div.divBox a').click(function(){
var vendor = $(this).text();
$('#myModal').off('show');
$('#myModal').on('show', function(){
$.ajax({
type: "GET",
url: "ip.php",
data: "id=" + vendor,
success: function(html){
$("#modal-body").html(html);
$(".modal-header h3").html(vendor);
$('.countstable1').dataTable({
"sDom": "T<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
"sPaginationType": "bootstrap",
"oLanguage": {
"sLengthMenu": "_MENU_ records per page"
},
"aaSorting":[[0, "desc"]],
"iDisplayLength": 10,
"oTableTools": {
"sSwfPath": "swf/copy_csv_xls_pdf.swf",
"aButtons": ["csv", "pdf"]
}
});
}
});
});
});
$('#myModal').on('hide', function () {
$("#modal-body").empty();
});
</script>