Can';我不明白为什么;jQuery文件上传";插件isn';行不通
在过去的一个小时里,我一直在努力工作 我无法解决的是这个js错误Can';我不明白为什么;jQuery文件上传";插件isn';行不通,jquery,jquery-file-upload,Jquery,Jquery File Upload,在过去的一个小时里,我一直在努力工作 我无法解决的是这个js错误未捕获的TypeError:$(…)。fileupload不是一个函数, 我试了很多东西。。我甚至从演示站点下载了js文件,但仍然出现了这个错误 我怎样才能解决它? 这是我的js文件(您可以看到,只有在加载dom时才会调用插件: $(document).ready(function () { $('#fileUpload').fileupload({ dataType: 'json', don
未捕获的TypeError:$(…)。fileupload不是一个函数
,
我试了很多东西。。我甚至从演示站点下载了js文件,但仍然出现了这个错误
我怎样才能解决它?
这是我的js文件(您可以看到,只有在加载dom时才会调用插件:
$(document).ready(function () {
$('#fileUpload').fileupload({
dataType: 'json',
done: function (e, data) {
$.each(data.result.files, function (index, file) {
$('<p/>').text(file.name).appendTo(document.body);
});
}
});
});
$(文档).ready(函数(){
$('#fileUpload')。fileUpload({
数据类型:“json”,
完成:功能(e,数据){
$.each(data.result.files,函数(索引,文件){
$('').text(file.name).appendTo(document.body);
});
}
});
});
这是我的.cshtml(我正在使用asp.net mvc)代码文件:
<h2>Index</h2>
<!-- Bootstrap styles -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<!-- blueimp Gallery styles -->
<link rel="stylesheet" href="//blueimp.github.io/Gallery/css/blueimp-gallery.min.css">
<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
<link href="~/Assets/plugins/jqueryFileUpload/css/jquery.fileupload.css" rel="stylesheet" />
<link href="~/Assets/plugins/jqueryFileUpload/css/jquery.fileupload-ui.css" rel="stylesheet" />
<!-- CSS adjustments for browsers with JavaScript disabled -->
<link href="~/Assets/plugins/jqueryFileUpload/css/jquery.fileupload-noscript.css" rel="stylesheet" />
<link href="~/Assets/plugins/jqueryFileUpload/css/jquery.fileupload-ui-noscript.css" rel="stylesheet" />
<input type='file' multiple id='fileUpload' name="files[]" data-url="@Url.Action("Upload","Home")" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included -->
<script src="~/Assets/plugins/jqueryFileUpload/js/vendor/jquery.ui.widget.js"></script>
<!-- The Templates plugin is included to render the upload/download listings -->
<script src="//blueimp.github.io/JavaScript-Templates/js/tmpl.min.js"></script>
<!-- The Load Image plugin is included for the preview images and image resizing functionality -->
<script src="//blueimp.github.io/JavaScript-Load-Image/js/load-image.all.min.js"></script>
<!-- The Canvas to Blob plugin is included for image resizing functionality -->
<script src="//blueimp.github.io/JavaScript-Canvas-to-Blob/js/canvas-to-blob.min.js"></script>
<!-- Bootstrap JS is not required, but included for the responsive demo navigation -->
<script src="//netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<!-- blueimp Gallery script -->
<script src="//blueimp.github.io/Gallery/js/jquery.blueimp-gallery.min.js"></script>
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
<script src="~/Assets/plugins/jqueryFileUpload/js/jquery.iframe-transport.js"></script>
<!-- The basic File Upload plugin -->
<script src="~/Assets/plugins/jqueryFileUpload/js/jquery.fileupload.js"></script>
<!-- The File Upload processing plugin -->
<script src="~/Assets/plugins/jqueryFileUpload/js/jquery.fileupload-process.js"></script>
<!-- The File Upload image preview & resize plugin -->
<script src="~/Assets/plugins/jqueryFileUpload/js/jquery.fileupload-image.js"></script>
<!-- The File Upload audio preview plugin -->
<script src="~/Assets/plugins/jqueryFileUpload/js/jquery.fileupload-audio.js"></script>
<!-- The File Upload video preview plugin -->
<script src="~/Assets/plugins/jqueryFileUpload/js/jquery.fileupload-video.js"></script>
<!-- The File Upload validation plugin -->
<script src="~/Assets/plugins/jqueryFileUpload/js/jquery.fileupload-validate.js"></script>
<!-- The File Upload user interface plugin -->
<script src="~/Assets/plugins/jqueryFileUpload/js/jquery.fileupload-ui.js"></script>
<script src="~/Assets/scripts/js.js"></script>
索引
更改后
$(文档).ready(函数(…){
到
$(文档).load(函数(…){
更改后,错误消失。
$(文档).ready(函数(…){
到
$(文档).load(函数(…){
错误消失。请检查Firebug Inspect元素中的控制台。控制台中未显示某些错误
我认为有些文件没有加载到您的网页上,或者在网页中找不到文件路径,因此发生此错误的原因。请检查Firebug Inspect元素中的控制台一些错误没有显示在控制台中
我想有些文件没有加载到您的网页上,或者在网页中找不到文件路径,因此发生了此错误。对于我来说,问题在于重复调用jquery.min.js脚本。对于我来说,问题在于重复调用jquery.min.js脚本。是否正确加载了jquery?请确保在加载之前加载了jqueryfileuploadit加载正确,这是我加载的第一件事。+错误与jquery无关。.它与插件有关。为什么在脚本文件之前有一个输入?如果没有加载JS文件,我肯定这不起作用是的,您需要使用来加载jquery@RanjithS请参阅第一个标记,jquery已加载jquery是否已加载正确?确保在文件上传之前加载jquery。正确加载它,这是我加载的第一件事。+错误与jquery无关。.它与插件有关。为什么在脚本文件之前有输入?如果没有加载JS文件,我肯定这不起作用。是的,您需要使用加载jquery@RanjithS看见第一个标签,jquery是loadedWorked对我来说很好。谢谢!对我来说很好。谢谢!