CFAjax: What it is and How to Use it - Code Analysis: The External js files
(Page 4 of 5 )
In the examples the relative references to these files are given. These have been changed in the present file (this tutorial) by giving absolute URL reference in the following three files.
<script type='text/javascript' src='http://
localhost/ajax/core/engine.js'></script>
<script type='text/javascript' src='http://
localhost/ajax/core/util.js'></script>
<script type='text/javascript' src='http://
localhost/ajax/core/settings.js'></script>
ColdFusion function reference
The function discussed earlier is used as shown here and is appended to the set of functions already present in the functions.cfm file in the examples folder. All examples reference file - functions.cfm from which the relevant function is processed during the XMLHTTP request.
<cffunction name="RightangleTriangle">
<cfargument name="x" required="yes" type="numeric">
<cfargument name="y" required="yes" type="numeric">
<cfset result=sqr(#x#*#x#+#y#*#y#)>
<cfreturn result>
</cffunction>
In the fourth <script/>, the _cfscriptLocation variable points to functions.cfm which also contains the function whose name is "RightangleTriangle" appended to it. The functions.cfm collects all the functions from several examples in the examples folder. An abbreviated version of functions.cfm is as shown below:
<!--- hint="type=keyvalue, jsreturn=array , listdelimiter=| , delimiter='='" --->
<cfinclude template="/ajax/core/cfajax.cfm">
<cffunction name="ziplookup">
<!---details of 'ziplookup' funciton--->
</cffunction>
<cffunction name="countylookup">
<!---details of 'countylookup' function-->
</cffunction>
<cffunction name="stateinfo">
<!---details of 'stateinfo' function--->
</cffunction>
<!--- ...... --->
<!---many other functions follow---> <!--- ...... --->
<cffunction name="RightangleTriangle">
<!---details of function used in this tutorial-->
<cfargument name="x" required="yes" type="numeric">
<cfargument name="y" required="yes" type="numeric">
<cfset result=sqr(#x#*#x#+#y#*#y#)>
<cfreturn result>
</cffunction>
Next: MyCFAjax.htm file >>
More ColdFusion Articles
More By Jayaram Krishnaswamy