I been browsing SO for solutions on how to load an ajax content on bootstrap popover but can't find any decent solutions.
Here's what I have so far:
$(".btnCharge").click(function () {
$("#boxPayment").fadeIn();
})
.popover({
title: 'Advantages',
html: 'true',
content: function () {
$.ajax({
type: "POST",
url: "Index.aspx/FindAdvantagesByCCID",
data: '{"id": "' + 1 + '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
var json = jQuery.parseJSON(data.d);
var html = '';
$.each(json, function (i, item) {
html = html + '<a href="#"><i class="icon-ok"></i>' + item.Advantage + '</a><br />';
});
}
});
},
placement: 'bottom',
trigger: 'hover'
});
How can i add the ajax response to popover content? I tried "return" and doesnt work.
Any clean solutions?