autosuggest (cfc and jquery) help

autosuggest (cfc and jquery) help

Hi All,

I  need some help on my task. Im stucked and need to see my error. Please help.
Basically, I just need to an autosuggest on my input text.


<title>Untitled Document</title>

$(function() {
//source: "states.cfm",
source: "cfc/S_Company.cfc",
minLength: 1,
select: function(event, ui) {
<cfinvoke component="cfc.S_Company" method="autosuggest">
<cfinvokeargument name="searchPhrase" value="#url.searchPhrase#">

<form action="index.cfm"  method="post">

<p class="ui-widget"><label for="company">Company Name : </label>
    <input type="text" id="company"  name="company" /> 

<p><input type="submit" name="submit" value="Submit" /></p>



Here's my component file : (S_Company.cfc) in a directory "cfc"
<cffunction name="autosuggest" access="remote">
<cfargument name="searchPhrase" type="any" />
<cfset returnArray = arrayNew(1) />
<cfset var id = 'id' />
<cfset var d_company_name = 'd_company_name' />
<cfquery name="qryCompany" dataSource="db_source">
Select * 
FROM table_company
WHERE d_company_name like <cfqueryparam value="%#Arguments.searchPhrase#%" cfsqltype="cf_sql_varchar">
<cfloop query="qryCompany">
<cfset compStruct = StructNew() />
<cfset compStruct["id"] = id />
<cfset compStruct["d_company_name"] = d_company_name />
<cfset ArrayAppend(returnArray,compStruct) />

My table is table_company
Columns: id, d_company_name, abbrev

Cannot make it work.Problem might be in jquery, jsoN or in my CFC. Please help.

Thank you very much.