Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <script src="http://code.jquery.com/jquery-2.0.0.js"></script>
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css">
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap-theme.min.css">
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
- <script language="javascript" type="text/javascript">
- //Function
- function foo(callback) {
- $.ajax({
- url: "http://api.openweathermap.org/data/2.5/weather?q=London",
- dataType: 'JSON',
- success: callback
- });
- }
- function myCallback(result) {
- var temp = JSON.stringify(JSON.parse(result.main.temp));
- var Kelvin = 272;
- var Centigrade = temp-Kelvin;
- $('span.temp-val').text(Centigrade);
- }
- $(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() { myCallback(); })
- });
- </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>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement