I use the code as follows:
$(\".reply\").popover({
content: \"Loading...\",
placement: \"bottom\"
});
$(\".reply\").popover(\"toggle\");
Most of these solutions actually seem hacky to me. Bootstrap standard docs have a method destroy
that can be used. So, on change of content via some event you can simply destroy and then recreate content.
.popover('destroy')
This properly dynamically loads, refreshes and re-renders the content of the popover.
I wrote an async popover for bootstrap 3.1.1. I just called it popoverasync
. Here is a demonstration:
async popover demo
You can download the source of the demo here:
demo source
The trick, for me, was to write the getContent
method of this async popover so the user's javascript function to retrieve the content will be invoked, but getContent
will return a wait animation, synchronously, back to the caller of getContent
. This way, the popover has content either way. First, while the user waits, and finally when the content arrives. What I am referring to can be found within extensions.js
in the demo source:
Hope this helps you!
Dan