ColdFusion 8: CFAjaxProxy

  • Post author:
  • Post category:Uncategorized

We’ve all heard of the cool new Ajax stuff in ColdFusion 8, particularly the UI stuff. But I haven’t seen many people mention CFAjaxProxy. This tag is basically a simple way to communicate with a CFC from the client using JavaScript. In the past I’d normally use a library like ajaxCFC to accomplish this, and we may still need those libraries. They may do a lot more than the stuff offered by CFAjaxProxy. Anyway, here’s a simple echo demo with CFAjaxProxy.This is your cfm page:
Put this code in a file and save it as echo.cfc, in the same folder as the cfm: This will basically take the name you type in the text field, and respond with “Hi {name}, how are you?” Very simple, but it shows the basic functionality available with CFAjaxProxy. CFAjaxProxy uses JSON for it’s data transfer format. You can set the proxy to use either Asynchronous (default) or Synchronous communication.