Home arrow ColdFusion arrow Page 5 - CFAjax: What it is and How to Use it

CFAjax: What it is and How to Use it

This is for ColdFusion aficionados who want to use Ajax. Ajax is implemented in such a way that ColdFusion method calls on the server gets executed using JavaScript a la Ajax. This tutorial shows you where to get the code and how to implement it on your local server.

Author Info:
By: Jayaram Krishnaswamy
Rating: 4 stars4 stars4 stars4 stars4 stars / 59
February 14, 2006
  1. · CFAjax: What it is and How to Use it
  2. · Implemented ColdFusion Function
  3. · CFAjax implementation of a ColdFusion function
  4. · Code Analysis: The External js files
  5. · MyCFAjax.htm file

print this article

CFAjax: What it is and How to Use it - MyCFAjax.htm file
(Page 5 of 5 )

This file, in addition to the script file references, has three HTML tags, two of which are input elements and the third is a <span/> element. When the browser is displayed, one can enter values into the two text boxes (assumed numerical values, no validation has been set up). When the boxes get blurred (when you step out of the box after typing in the value), the function is evaluated and the result gets written to the <span/> element.

When the browser displays as the <body> loads, the init () function is evaluated. This in turn calls the loadInfo () function. The loadInfo () calls the DWRUtil which extracts the values sent by the clients at objects with ids x and y using the getValue () method. The DWREngine._execute () function uses these values; the function name; the function through the variable _cfscriptLocation;  and the result of running this function in getResult variable. The getResult () function passes the result using the HTML's DOM parser to the 'info' <span/> element. The result of the computation gets written to the <span/>.  The browser display of MyCFAjax.htm will be as shown:


One of the objectives in writing this tutorial was to introduce our readers to CFAjax. Another objective was to explain why some of the examples in the download may not work immediately. A detailed step-by-step procedure for creating a virtual directory referencing the downloaded directory has been described. The place where the user function needs to be appended is also shown using the virtual directory so created. An extremly simple example was chosen to highlight the use of the CFAjax code as related to its constituent external script files.  Template reference of <cfinclude> is not referenced absolutely; some examples may require this to be changed as well. I thank James Holmes for showing clear documentation for the DWREngine._execute() method.

DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

blog comments powered by Disqus

- Adobe ColdFusion Just Got More RAD
- How to Access a SQL Anywhere Database with C...
- CFXML: Probing XMLDOM in ColdFusion
- Creating a Web Service with ColdFusion: the ...
- CFAjax: What it is and How to Use it
- Querying SQL 2000 Server from ColdFusion
- Introduction to ColdFusion Markup Language, ...
- Introduction to ColdFusion Markup Language
- Databases and Dreamweaver MX 2004, concluded
- Databases and Dreamweaver MX 2004
- Welcome to Coldfusion MX 6.1, concluded
- Welcome to Coldfusion MX 6.1
- What You Must Know About ColdFusion Flow-Con...
- What You Must Know About Operators in ColdFu...
- Everything You Must Know About ColdFusion Va...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials