JSFiddle - React, Tailwind, and code Playground
by D S
HTML
<script src="http://connect.soundcloud.com/sdk.js"></script>
<a class=".buttonDownload"></a>
<br><br><br>
<button id="press" onClick="checkIT()">Press</button>
CSS
.buttonDownload{
background: url(http://goo.gl/JQDTDz) center no-repeat;
}
.buttonBuy{
background: url(http://goo.gl/62JrjS) center no-repeat;
}
.buttonNA{
background: url(http://goo.gl/s6HsMJ) center no-repeat;
}
JavaScript
SC.initialize({
client_id: "b8f06bbb8e4e9e201f9e6e46001c3acb",
});
// 156365722 no dl - buy
// 155552335 dl buy
// 67658191 buy
// 27020927 buy
// 139553877 dl
SC.get("/tracks/156365722", function(tracks){
$("#press").click(function(){
downloadME(tracks);
})
});
function downloadME(tracks){
if (tracks.downloadable) {
$("#demo").text("dl");
}
else if (tracks.purchase_url != null) {
$("#demo").text("buy");
}
else {
$("#demo").text("Not Active");
}
}