简体   繁体   中英

Javascript Uncaught type error undefined is not a function

I am trying to include a video file upload feature on my website:

I am following the example as posted here: http://davidsonsousa.net/en/post/how-to-upload-a-file-using-mvc-3-and-ajax

I have included all the necessary libraries in my MVC project.. In my view I included the below header:

<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>

When I load my web page I get the following errors:

Uncaught type error undefined is not a function Which points to this section in the upload script: $('#fileupload').fileupload({

I also get thee errors:

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

It seems like jQuery is not being loaded. Open your browser's debugger (F-12) and look at the NETWORK tab. Reload the page and look for a 404 error. You likely have the wrong path.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM