duan111112 2017-03-15 20:40
浏览 55

尝试输出视频时出现Javascript错误

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.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信会员卡接入微信支付商户号收款
    • ¥15 如何获取烟草零售终端数据
    • ¥15 数学建模招标中位数问题
    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?