ColdFusion & Ajax: Error Invoking CFC

不问归期 提交于 2019-12-13 19:24:15

问题


I have tried multiple tutorials on this topic from Forta.com and yet run into the same error: "Error invoking CFC/....(file path)../wgn.cfc: Internal Server Error [Enable debugging by adding 'cfdebug to your URL parameters to see more info]"

I am working on my local machine and testing as localhost. Running WinXP Pro with sp3. Using Coldfusion's web server.

Both my .cfm and .cfc are in the same folder under the the webroot. In my case: c:\ColdFusion9\wwwroot\bridges(.cfm and .cfc here) So, they are in a "bridges" folder under wwwroot.

The code should generate some autosuggest functionality when the user types in the input box. Instead, it just spits back the above error.

This is my cfc named wgn.cfc:

<cfcomponent output="false">
    <cfset THIS.dsn="bridges">
      <!--- Lookup used for auto suggest --->
      <cffunction name="getWGN" access="remote" returntype="array">
        <cfargument name="search" type="any" required="false" default="">
        <!--- Define variables --->
        <cfset var data="">
        <cfset var result=ArrayNew(1)>
        <!--- Do search --->
        <cfquery datasource="#THIS.dsn#" name="data">
        SELECT tblIDs.ID
        FROM tblIDs
        WHERE (tblIDs.IDType = 'xxx') AND (tblIDs.ID Like ('#ARGUMENTS.search#%'));
        </cfquery>
        <!--- Build result array --->
        <cfloop query="data">
        <cfset ArrayAppend(result, searchIDs)>
        </cfloop>
         <!--- And return it --->
        <cfreturn result>
       </cffunction>  
</cfcomponent>

And this is the relevant part of the form from my .cfm page:

    <cfform .....>
    <cfinput name="searchIDs" type="text" autosuggest="cfc:wgn.getWGN({cfautosuggestvalue})">
    //......more to form, obviously
    </cfform>

回答1:


UPDATE Solution:

change
 <cfset ArrayAppend(result, searchIDs)>
to
 <cfset ArrayAppend(result, ID)>


来源:https://stackoverflow.com/questions/3925069/coldfusion-ajax-error-invoking-cfc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!