I am trying to make an audio player that takes an mp3 file from JSONP, and sends it to an HTML audio player. The JSONP is not included in this code, I simplified it to have the mp3 file included as a variable. Anyway, I was wondering how to pass that Javascript variable onto the HTML as the src for the audio player. Thanks!
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<div></div>
<script>
var theFile = 'foo.mp3';
$("div").html("<audio src= theFile controls preload='auto' autobuffer></audio>");
</script>
</body>
1 Answer