Hi, i'm new here.
I have some code that i am trying to get working to display live prices in various currency on a site i am working on as a bit of a hobby as btc interests me and im planning on buying some soon.
The codes i have inserted into the site are as follows.
This goes in the wordpress header =
<script src="js/jquery-1.10.2.min.js"></script>
This goes in the body of the wordpress page =
<script>
$( ".currencySwitch" ).click(function( event ) {
$( ".currencySwitch" ).removeClass( "active" );
$( this ).addClass( "active" );
event.preventDefault();
var countryCode = $( this ).data( "code" );
$.ajax({
type: 'POST',
url: 'ajax.php',
data: { country: countryCode },
dataType: 'json',
beforeSend: function() {
$( "#price" ).html( "<div class=\"loading\"></div>" );
},
success: function (data) {
window.history.pushState( "Updating URL", countryCode, "/?currency=" + countryCode );
$( "#price" ).fadeOut(function() {
$( this ).text( data.price ).fadeIn( "fast" );
});
}
});
});
</script>
I get lost from there on. You can see what it is trying to function here http://www.currentpriceofbitcoin.co.uk/btc-news. I guess what i really need is the code to draw from a price source.
Any help would be appreciated.