jquery - assign query result to variable and use it in javascript -
<script type="text/javascript"> $('x').load("https://blockchain.info/q/getreceivedbyaddress/1pt9trjkeaw61ar1elqpuzkdmayxzkctrn",function(){ var formatted_value=$('x').text();//$('**x**') selector class var goalgauge = new gauge(); goalgauge.draw(formatted_value); }); </script> <canvas id="gauge" width="240" height="240" style="display: block; width: 240px; margin: 0px auto;"></canvas></div>
the query sends number used fill gauge. how assign received value var formatted_value ?
it works now. code is:
<div style="width: 100%; float: left;"> <div id="x"></div> <canvas id="gauge" width="240" height="240" style="display: block; width: 240px; margin: 0px auto;"></canvas> </div> <script type="text/javascript"> $('#x').load("https://blockchain.info/q/getreceivedbyaddress/1pt9trjkeaw61ar1elqpuzkdmayxzkctrn", function () { var formatted_value = $('#x').text(); //$('**x**') selector class var goalgauge = new gauge(); goalgauge.draw(formatted_value); }); </script>
load async so,
$('**x**').load("https://blockchain.info/q/getreceivedbyaddress/********",function(){ var formatted_value=$('**x**').text();//$('**x**') selector class var goalgauge = new gauge(); goalgauge.draw(formatted_value); });
Comments
Post a Comment