Reputation:
Audio player not serving its purpose, audio source URL received in JSON
and saved in a audio path, variable passed as SRC
attribute, still doesn't seem to work
var audio_path = json_defects.audio_path;
$('#audio_edit').html('<audio controls><source src="audio_path" type="audio/mpeg"></audio>');
Upvotes: 0
Views: 187
Reputation: 218960
You're setting the src
to the literal string "audio_path"
. Variables don't automatically expand in strings.
Instead, concatenate the variable into the resulting string:
'<audio controls><source src="' + audio_path + '" type="audio/mpeg"></audio>'
Upvotes: 1