[英]Javascript Uncaught type error undefined is not a function
我正在尝试在我的网站上添加视频文件上传功能:
我正在遵循此处发布的示例: http : //davidsonsousa.net/en/post/how-to-upload-a-file-using-mvc-3-and-ajax
我已经在我的MVC项目中包括了所有必需的库。.在我看来,我包括以下标头:
<head>
<title>Videos </title><!-- Bootstrap core CSS -->
<link href="~/Scripts/jquery-lib/jquery.fileupload.css" rel="stylesheet" />
<script src="/Scripts/jquery-lib/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery-lib/jquery.ui.widget.js" type="text/javascript"></script>
<script src="/Scripts/jquery-lib/bootstrap.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery-lib/jquery.fileupload.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#fileupload').fileupload({
dataType: 'json',
url: '/Videos/UploadVideoFile/?isrc=' + 'HGTGHTGTYTGT',
autoUpload: true,
done: function (e, data) {
$('.file_name').html(data.result.name);
$('.file_type').html(data.result.type);
$('.file_size').html(data.result.size);
}
}).on('fileuploadprogressall', function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$('.progress .progress-bar').css('width', progress + '%');
});
});
</script>
</head>
加载网页时,出现以下错误:
未捕获的类型错误undefined不是指向上传脚本中此部分的函数:$('#fileupload')。fileupload({
我也得到你的错误:
Uncaught TypeError: undefined is not a function add:96
Uncaught ReferenceError: jQuery is not defined jquery.ui.widget.js:18
Uncaught ReferenceError: jQuery is not defined bootstrap.min.js:6
Uncaught TypeError: Cannot read property 'support' of undefined jquery.fileupload.js:32
Uncaught ReferenceError: $ is not defined add:95
Uncaught TypeError: Cannot read property 'support' of undefined jquery.fileupload.js:32
Uncaught ReferenceError: $ is not defined
看来jQuery没有被加载。 打开浏览器的调试器(F-12),然后查看“网络”选项卡。 重新加载页面并查找404错误。 您可能走错了路。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.