I am making a website, where a user can save a video to his library. My videos have ID's: 1,2,3 etc... But I'm getting this error and I don't know what is the problem.
That is the error I'm getting:
Uncaught ReferenceError: show is not defined at HTMLLIElement.onclick (index.php:51)
Here is my JS code:
//Videos
function show(vidIDs) {
$.ajax({
type: "GET",
url: '././video_display.php', //the script to call to get data
data: 'vidIDs=' + vidIDs,
dataType: 'json', //data format
success: function () {
var i;
for (i = 1; i < vidIDs.length; i++) {
var video = document.createElement("VIDEO");
video.src = vidIDs[i] + ".mp4";
video.setAttribute("controls", "controls");
document.getElementById("myDIV").appendChild(video);
}
}
});
}
And my HTML code:
<li data-toggle="modal" onclick='show(<?php include 'video_display.php'; ?>)'
data-target="#video"><span class="fa fa-map-marker fa-fw"></span>
The result should be that a pop-up appears displaying the videos.