JavaScript variable not working in HTML Audio control? -
audio player not serving purpose, audio source url received in json
, saved in audio path, variable passed src
attribute, still doesn't seem work
var audio_path = json_defects.audio_path; $('#audio_edit').html('<audio controls><source src="audio_path" type="audio/mpeg"></audio>');
you're setting src
literal string "audio_path"
. variables don't automatically expand in strings.
instead, concatenate variable resulting string:
'<audio controls><source src="' + audio_path + '" type="audio/mpeg"></audio>'
Comments
Post a Comment