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