html - Javascript function content in bootstrap popover area -
i want have function content bootstrap popover area. how that? adding 1 jsfiddle :
http://jsfiddle.net/zc1xj3sn/2/
inserting image done. want function inserted.
another code tried :
<!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; //alert("temperature : "+math.round(centigrade)+" c"); document.getelementbyid("temp").innerhtml = "temperature : "+math.round(centigrade)+" c"; } $(function() { $("[data-toggle='popover']").popover(mycallback); }); </script> </body> <a href="#" tabindex="0" class="btn btn-lg btn-danger" role="button" data-toggle="popover" data-trigger="focus" title="temperature" data-content= "mycallback(result);" >temperature</a> </html>
here want have populated data mycallback(result) function
but not able that, can please tell me have do?
Comments
Post a Comment