繁体   English   中英

Bootstrap加载状态Ajax问题

[英]Bootstrap Loading State Ajax Issue

在ajax收到来自PHP脚本的响应之前,一直保持“加载”状态的问题。 “加载”起初起作用,保留约一秒钟,然后消失,然后在响应后重置。 想要让Button保持“正在加载...”,直到PHP脚本完成。

HTML:

<button type="button" class="btn btn-outline btn-info" id="parse_all" data-loading-text="Loading...">
    <i class="glyphicon glyphicon-refresh"></i>
    <span>Parse All Data</span>
</button>
<div id="parse_resp"></div>

JavaScript:

$('#parse_all').click(function() {
    var btn = $(this)
    btn.button('loading');
    $.ajax({
        type: "GET",
        url: "parse_all.php",
        dataType: 'html',
        success: function(response){
            btn.button('reset');
            $("#parse_resp").html(response);
        }
    });
});

使用“ btn-outline”类的按钮上的Bootstrap加载状态似乎不起作用。 解决方案:删除“ btn-outline”类。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM