How to show rates from Mt.Gox with Javascript


SUBMITTED BY: Guest

DATE: Jan. 1, 2014, 6:11 a.m.

FORMAT: JavaScript

SIZE: 873 Bytes

HITS: 1161

  1. // Prepare places for the rates to go in.
  2. // This example looks for elements with the id's:
  3. // 'ticker-high','ticker-low','ticker-avg','ticker-volume','buy','sell'
  4. <script type="text/javascript">
  5. $(function() {
  6. $(document).ready(function(){
  7. $.getJSON('https://data.mtgox.com/api/1/BTCUSD/ticker', function(data) {
  8. $('#ticker-high').html(data['return'].high.display_short);
  9. $('#ticker-low').html(data['return'].low.display_short);
  10. $('#ticker-avg').html(data['return'].avg.display_short);
  11. $('#ticker-volume').html(data['return'].vol.display_short);
  12. $('#ticker-buy').html(data['return'].buy.display_short);
  13. $('#ticker-sell').html(data['return'].sell.display_short);
  14. });
  15. });
  16. })
  17. </script>

comments powered by Disqus