This is my html and js file:
window.onload = function(){
SC.initialize({
client_id: "f5311a935daa5ecf6440f92183e77df1"
});
var menuLinks = document.getElementsByClassName("genre");
for (var i=0; i < menuLinks.length; i++){
var menuLink = menuLinks[i];
menuLink.onclick = function(e){
e.preventDefault();
playSounds(menuLink.innerHTML);
};
};
};
function playSounds(genre){
SC.get('/tracks', {genres: genre}, function(tracks){
var random = Math.floor(Math.random()*49);
SC.oEmbed(tracks[random].uri, {autoplay: false}, document.getElementById("content"));
});
};
<html>
<head>
<title>SoundCloud API</title>
<script type="text/javascript" src="script.js"></script>
<script src="//connect.soundcloud.com/sdk-2.0.0.js"></script>
</head>
<body>
<ul>
<li><a href="#" class="genre">electronic</a></li>
<li><a href="#" class="genre">trap</a></li>
<li><a href="#" class="genre">dubstep</a></li>
</ul>
<div id="content"></div>
</body>
</html>
So basically when I click on any of the links, it should search for that particular genre but instead it searches only for dubstep no matter which link I click on. Can anyone please help?