Struggle with cfc and autocomplete

Hi, I’m new to lucee and I’m trying to setup an autocomplete form with lucee and jquery but I always get this error ts_post.cfm:49 Uncaught TypeError: $(…).autocomplete is not a function

Below is my code for page where the input is

meta charset=“utf-8”>
title>autocomplete
link rel=“stylesheet” href=“//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css”>
script src=“//code.jquery.com/jquery-1.12.4.js”>
script src=“//code.jquery.com/ui/1.12.1/jquery-ui.js”>
/head>
body>

form>
Enter text:
input type=“button” id=“submit” value=“Submit” />
/form>
script type=“text/javascript”>
$(document).ready(function() {
$(‘#inputauto’).autocomplete({
source: function(query, response) {
$.ajax({
url: “autocomplete.cfc?method=queryNames&returnformat=json”,
dataType: “json”,
data: {
searchPhrase: query.term
},
success: function(result) {
response(result);
}
});
}
});
});
/script>

/body>
/html>

And the second page the call to the autocomplete.cfc

cfcomponent>
cffunction name=“queryNames” access=“remote”>
cfargument name=“searchPhrase” />

    <cfquery name="query_names" maxrows="10" datasource="chantiers">
        SELECT    *
        FROM      chantier
        WHERE    id LIKE <cfqueryparam cfsqltype='cf_sql_varchar' value="%#LCASE(arguments.searchPhrase)#%" />
        ORDER BY  Name
    </cfquery>

    <cfset result = arrayNew(1) />

    <cfloop query="query_names">
        <cfset ArrayAppend(result, query_names.Name) />
    </cfloop>

    <cfreturn result />
</cffunction>

/cfcomponent>

If somebody can help me

Summary

This text will be hidden

Do you have Lucee debugging enabled? It also loads jQuery without the conflict handling which breaks pages as the Lucee loaded version doesn’t have any plugins you loader into your own version

1 Like

yes, I have, just disable it and check again it solved the problem, many thanks

great, glad I could help.

please vote for this bug! [LDEV-2254] - Lucee