title: Multiply variables retrieved from API
body: <pre><code>getValue = ( url, callback) -&gt;
    $.getJSON url, (json) -&gt;
      value = json.last
      callback value
  
  
  $(window).load -&gt;
  
    btsx_btc = getValue "http://data.bter.com/api/1/ticker/btsx_btc", (data) -&gt;
      $('#v_btsx_btc').html data
  
    btc_usd = getValue "http://data.bter.com/api/1/ticker/btc_usd", (data) -&gt;
      $('#v_btc_usd').html data
  
    $('#v_btsx_usd').html btsx_btc*btc_usd
  </code></pre>
  
  <p>I'm pretty new to JavaScript and Coffeescript. I can succesfully retrieve 2 values (btsx_btc &amp; btsc_USD). I want to multiply those 2 variables and show it in the middle one. But its not working, the console is not showing any errors. I presume that the 2 variables are empty somehow. I hope you guys can help</p>
  
  <p><img src="https://i.stack.imgur.com/ap5AH.png" alt="http://i.imgur.com/gTDaDpD.png">    </p>
  
  <p>This is the output javascript</p>
  
  <pre><code>(function() {
    var getValue;
  
    getValue = function(url, callback) {
      return $.getJSON(url, function(json) {
        var value;
        value = json.last;
        return callback(value);
      });
    };
  
    $(window).load(function() {
      var btc_usd, btsx_btc;
      btsx_btc = getValue("http://data.bter.com/api/1/ticker/btsx_btc", function(data) {
        return $('#v_btsx_btc').html(data);
      });
      btc_usd = getValue("http://data.bter.com/api/1/ticker/btc_usd", function(data) {
        return $('#v_btc_usd').html(data);
      });
      return $('#v_btsx_usd').html(btsx_btc * btc_usd);
    });
  
  }).call(this);
  </code></pre>