I'm trying to add a variable within a new variable.
My first variable is:
var video5 = myObj.find('hosted-video-url').text(); (this returns a direct link to an mp4-file)
My second one should be something like:
var playvid5 = "playVideo('"video5"')";
Variable playvid5 should result "playVideo('http://link.to/video.mp4)')"
When I try to make variable playvid5 in the way I showed above, my whole code stops working and nothing is displayed. When I use var playvid5 = "playVideo('"+video5+"')";, the output is "playVideo('')", so that's not what I need either.
I'm trying to place the 2nd variable in this piece: ('<a href="#" onclick="'+playvid5+'">Bekijk video</a>')
In what way can I place the first variable in the second one?
var playvid5 = "playVideo('"+video5+"')";is entirely correct. The fact that your're ending up with"playVideo('')"indicates that video5 is not being set properly, ie video5 is null.