Sam Farmer

Growing up I never imagined I would play bass guitar for the Dave Matthews Band. And indeed it never happened.

But I have become passionate about making software.

cfAjaxProxy and Mach-II

June 8, 2008

Here's an easy way to use cfAjaxProxy with a Mach-II application.

First I created a new cfc that extends Application.cfc to gain access to all of the Mach-II features.

Then add a function with access="remote" and list all of the arguments (cfajaxproxy requires all arguments be defined). Next set all the arguments to the form or url scope so that Mach-II can read them. Finally call handleRequest().

<cfcomponent output="false" extends="Application"> <cffunction name="getData" access="remote" output="true" hint="">  <cfargument name="artistID" default="">  <cfargument name="artistName" default="">  <cfset url.event = "user.edit">  <cfset url.artistID = arguments.artistID>  <cfset url.artistName = arguments.artistName>  <cfset handleRequest()> </cffunction> </cfcomponent>

I'm sure there are cleaner ways but this works and allows easy use of the great cfAjaxProxy tag in a Mach-II application.

No Comments

Some comments have been lost over the years due to moving hosts.


More blog entries that I have written.

Code coloring by PRISM.