This tag provides a Javascript API to the remote CFC making it very easy to utilise server side calls. Only CFC methods that are marked as 'remote' can be exposed through this manner. The resulting Javascript is independent of any popular Javascript library. You can pass rich objects such as arrays and structures to the remote CFC with no problems. This function will do the necessary encoding and decoding on the fly.




Attribute default required summary
ATTRIBUTECOLLECTION A structure containing the tag attributes
CFC The path of where the CFC you wish to call is, as seen by the client (for example browser), not the server. Functions marked as 'remote' are exposed as Javascript functions
JSCLASSNAME The name of the Javascript object that will be available in the page
INLINE false Do you wish this Javacript block to be rendered inline, or as a remote URL resource


This tag creates Javascript proxy objects to your server side CFC components. This makes calling remote CFC from Javascript extremely easy and straight forward. The Javascript produced by this tag is completely independent of any client side library and can safely be used along side the likes of JQuery and YUI.

<cfajaxproxy cfc="mycfc" jsclassname="jsmycfc">

// Using Synchronized callback
getUserRecord = function( id ) {
  var jsmycfcInst = new jsmycfc();
  return jsmycfcInst.getUserRecord(id);

// Using ASynchronized callback
callbackMethod = function( result ){


getUserRecordAsync = function( id ) {
  var jsmycfcInst = new jsmycfc();
  jsmycfcInst.setCallbackHandler( callbackMethod );

setUserRecordAsync = function() {
  var jsmycfcInst = new jsmycfc();
  jsmycfcInst.setCallbackHandler( callbackMethod );
  jsmycfcInst.setUserRecord( { name:"Susan", age : 21, address : {street1: "House 1", street2: "Glebe Av.", town: "Glasgow" } }  );

The following CFC would be a sample content for jsmycfc

<cfcomponent public="yes" output="false">

  <cffunction name="getUserRecord" access="remote" returntype="structure">
    <cfreturn {id:1, name:"susan"}>

  <cffunction name="setUserRecord" access="remote" returntype="boolean">
    <cfargument name="user" type="struct" required="true" />
    <!--- do something with this record --->
    <cfreturn true>


There are a number of helper methods that come with each proxied object created.

Method Name Description
setCallbackHandler Takes in the Javascript function reference that will receive the callback upon completion of the result
setErrorHandler Takes in the Javascript function reference that will be called should an error occur
setAsyncMode Sets the mode of network operation to be asynchronized. If you are expecting a result back then you should use a callback handler, otherwise you can fire'n'forget
setSyncMode Sets the mode of network operation to be synchronized. This means the page will wait until the server responds with the result
setForm The ID of the FORM that the library will automatically pull together all the values of the HTML form and post that to the server end point
setHTTPMethod The type of method that will be used. Defaults to GET but can be POST. There will always be an anti-cache busting token added to each request to prevent browser caching