I use the following script to call the CFC function:
function loadQuery() { $.get('QueryData.cfc',{},function(GetMyData){ $("#content").html(GetMyData) }) return false } $(document).ready(function() { $("#loadLink").click(loadQuery) });
This is my HTML:
<a href="" id="loadLink">Load It</a> <div id="content"></div>
I call the following CFC:
<cffunction name="GetMyData" access="public" returntype="query"> <cfargument name="RecordID" type="string" required="yes"> <cfset var RecordData = ""> <cfquery name="RecordData" datasource="MyDSN"> SELECT foo.RecordID, foo.RecordName FROM foo WHERE foo.RecordID = #ARGUMENTS.RecordID# ; </cfquery> <cfreturn RecordData>
The problem is that when I call CFC, the CFC page appears; a CFC description appears (after asking for the administrator password). I do not want to load QueryData.cfc; I want to execute a function inside QueryData.cfc.
The second problem is that I cannot understand the syntax for passing an argument to the CFC method.
source share