I just can't figure out why my script isn't working. I tried several solutions I found here, also tried using .ajax(), but no results.
I must've missed something because it's not the first time I'm using .get or making something similar.
<div class="test"></div>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script>
    $(function() {
        var btc = getBTC(10);
        $('.test').html(btc);
    });
    function getBTC(val) {
        $.get("https://blockchain.info/tobtc?currency=EUR&value=" + val, function(data) {
            return data;
        });
    }
</script>
If I change return data; to console.log(data); then execute getBTC(10); in the console it works fine. I'm a little bit confused here.
 
     
    