Rtra Rtra -4 years ago 140
Javascript Question

Bootstrap popover loading

Hello I am trying to show "Loading..." text or spinner image until the dynamic ajax content loads because I have a very large number of data to fetch with takes at least 2-3 seconds to fully load here is my Ajax code

$(document).ready(function(){
$('[data-toggle="popover"]').popover({
trigger: "hover",
title:fetchData,
html:true,
placement:'right'
});
function fetchData(){
var fetch_data = '';
var element = $(this);
var id = element.attr("id");
$.ajax({
url:"includes/modDashboard/GetSummaryInfo.php",
method:"POST",
async:false,
data:{id:id},
success:function(data){
fetch_data = data;
}
});
return fetch_data;
}
});

Answer Source

My solution related to the issue: jshiddle

<div class="col-lg-6">
    <a href="#" data-toggle="popover1" class="btn btn-block btn-default" id="cash_4">
        Cash Summary
    </a>

Good luck and regards Rtra :)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download