I've looked up similar questions, but haven't been able to make this work. Sorry if this is a basic question.
This works for me with an on-click button:
var player = document.createElement('audio');
player.src = 'http://jplayer.org/audio/ogg/Miaow-07-Bubble.ogg';
player.load();
player.play();
How can I replace the URL with a variable - "sound1", where the variable fetches a different URL? I tried this for the 2nd line, to no avail:
player.src = "'" + sound1 +"'";
Thanks.