GET 404 not found jquery Autocomplete

Viewed 102

For an input on an JSP- i want to show suggestions relating to the input.

My controller-

@GetMapping(value = "/customerAutoComplete")
    @ResponseBody
    public List<String> customerAutoComplete(@RequestParam(value = "term",
            required = true, defaultValue = "") String term){
        List<String> ls=new ArrayList<String>();
        ls.add("L110");
        ls.add("L111");
        ls.add("L011");
        return ls;

    }

JSP page-

<script type="text/javascript">
        $(function() {
            $("#customerCode").autocomplete({
                source: "/customerAutoComplete",
                minLength:2
             });
         });
</script>
//input somewhere in the file-
<div class="form-group">
     <label for="customerCode" class="font-weight-bold ">Customer#</label>
     <input type="text" class="form-control" name="customerCode" id="customerCode" required oninput="customerf()"/>
</div> 

I am currently on the page- http://127.0.0.1:8080/Project-SNAPSHOT/loanDisbursalForm

I have tried changing the get mapping value to -"/loanDisbusralForm/customerAutoComplete" but still no luck.

Exact error-

jquery-3.5.1.js:10099 GET http://127.0.0.1:8080/customerAutoComplete?term=L1 404 (Not Found)

Note- When i loading the loan disbursalForm i am also getting this error dont know it has some connection with it or not-

Refused to apply style from 'http://127.0.0.1:8080/Project-SNAPSHOT/styles.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
1 Answers

Using proper versions of jquery and especially jquery ui solved the issue.

Related