JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<div class="bs-example">
<p class="popover-examples">
<a href="#" class="btn btn-lg btn-primary" data-toggle="popover" >Popover Example</a>
</p>
</div>
CSS
.bs-example{
margin: 50px;
}
JavaScript
function foo() {
$.ajax({
url: "http://api.openweathermap.org/data/2.5/weather?q=London",
dataType: 'JSON',
success: function(result) {
var temp = JSON.stringify(JSON.parse(result.main.temp));
var Kelvin = 272;
var Centigrade = temp-Kelvin;
var temperature = "Temperature : "+Math.round(Centigrade)+" C";
$('span.temp-val').text(temperature);
}
});
}
$(document).ready(function(){
$(".popover-examples a").popover({
title : 'Weather App',
trigger: 'hover',
template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div><img src="http://lorempixel.com/100/100" /><span class="temp-val">Just an example of inserting image in a Popover...</span></div>'
});
$(".popover-examples a").hover(function() { foo(); })
});