Click here to Skip to main content
15,887,273 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I get an error on auto complete as below. So how to solve this issue so can't modify?

JavaScript
jquery-1.5.min.js:16 Uncaught TypeError: Cannot read properties of undefined (reading 'length')
    at Function.each (jquery-1.5.min.js:16:10613)
    at t.widget (jquery-ui.min.js:6:4729)
    at jquery-ui.min.js:7:13824
    at jquery-ui.min.js:6:73
    at jquery-ui.min.js:6:84
bootstrap.js:15 Uncaught Error: Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4
    at bootstrap.js:15:11
    at bootstrap.js:17:2
datatables.min.js:176 Uncaught TypeError: l(...).on is not a function
    at datatables.min.js:176:457
    at datatables.min.js:60:299
    at datatables.min.js:60:326
jquery.validate.unobtrusive.js:156 Uncaught TypeError: $form.off is not a function
    at Object.attachValidation (jquery.validate.unobtrusive.js:156:26)
    at HTMLFormElement.<anonymous> (jquery.validate.unobtrusive.js:249:26)
    at Function.each (jquery-1.5.min.js:16:10828)
    at init.each (jquery-1.5.min.js:16:7403)
    at Object.parse (jquery.validate.unobtrusive.js:246:20)
    at HTMLDocument.<anonymous> (jquery.validate.unobtrusive.js:428:28)
    at Object.resolveWith (jquery-1.5.min.js:16:12509)
    at Function.ready (jquery-1.5.min.js:16:8628)
    at HTMLDocument.A (jquery-1.5.min.js:16:14342)
RequesterIndex?filenumber=103085:351 Uncaught ReferenceError: searchText is not defined
    at HTMLInputElement.<anonymous> (RequesterIndex?filenumber=103085:351:41)
    at HTMLInputElement.handle (jquery-1.5.min.js:16:28630)
    at HTMLInputElement.l (jquery-1.5.min.js:16:25280)


What I have tried:

JavaScript
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
    <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css" type="text/css" media="all" />
    <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.min.js" type="text/javascript"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js" type="text/javascript"></script>
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<script>
    //--work success----
    @*$(document).ready(function () {
        $("#txtLineManagerId").change(function () {
            var searchText = $("#txtLineManagerId").val();
            console.log("search text" + searchText)
            $.ajax({
                url: '@Url.Action("GetAllEmployeeBasedSearchText", "Resignation")',
                data: { searchText: searchText},
                method: "GET",
                dataType: "json",
                success: function (data) {
                    /* console.log("data is " + data);*/
                    response($.map(data, function (item) {
                        return { label: item.EmployeeID, value: item.EmployeeID };
                    }))

                }
            });
      });
    });*@
    $(document).ready(function () {
        $("#txtLineManagerId").autocomplete({
            source: function (request, response) {
                var searchText = $("#txtLineManagerId").val();
                console.log("search text" + searchText)
                $.ajax({
                    url: '@Url.Action("GetAllEmployeeBasedSearchText", "Resignation")',
                    data: { searchText: searchText },
                    method: "GET",
                    dataType: "json",
                    success: function (data) {
                        /* console.log("data is " + data);*/
                        response($.map(data, function (item) {
                            console.log("data is" + item.EmployeeID);
                            return { label: item.EmployeeID, value: item.EmployeeID };
                        }))
                    }
                });
            }
        });
   /* });*/
Posted
Updated 29-Aug-23 0:43am
v2
Comments
Dave Kreskowiak 24-Aug-23 10:04am    
You are never going to learn a damn thing unless you start to actually READ ERROR MESSAGES!

1 solution

Quote:
Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4
HTML
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.min.js" type="text/javascript"></script>

<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js" type="text/javascript"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
You have included two different versions of jQuery, and two different versions of jQuery UI.

You have then completely ignored the error message, which would have pointed you in the right direction. But I guess we should expect nothing more from our resident "Help Vampire"!

Remove the duplicate scripts, keeping the later version of each.
 
Share this answer
 
Comments
Andre Oosthuizen 24-Aug-23 5:10am    
Quote: expect nothing more from our resident "Help Vampire"! - Yup +5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900