javascriptjquerybootstrap-popover

How to disable multiple ajax call in a bootstrap popover


I have implemented a popover. Whenever you click on an element I will make an AJAX request. Unfortunately there are two AJAX calls being sent. How do I prevent this? I only want to make a single AJAX call.

$(".btn-course-user").popover({
  html: true,
  trigger: 'manual',
  viewport: '',
  template: '',
  placement: 'bottom',
  content: function() {
    return $.ajax({
      url: 'lorem/ipsum/',
      dataType: 'html',
      async: false
    }).responseText;
  }
}).click(function(e) {
  $(this).popover('toggle');
});

Whenever I click on the element with class selector .btn-course-user it sends two AJAX requests. Can someone help me to prevent it. I want to send a single request.


Solution

  • The issue was i have not added title property for the popover.

    For more clarity