As an aside, Rob Gonda's AjaxCFC handles numbers 2 and 3 below nicely, and he's 
built a hook into jquery into the latest version.  You can set the return type 
to JSON or WDDX, and it will report a nice error message for you if there's an 
error in your cfc.  Not sure how that would tie in with the need for a facade, 
but it could probably be integrated.

-- Josh

  ----- Original Message ----- 
  From: Dan G. Switzer, II 
  To: jquery-en@googlegroups.com 
  Sent: Thursday, April 05, 2007 12:12 PM
  Subject: [jQuery] Re: Coldfusion: using $.get() to directly call a CFC living 
outside of the webroot


  Andy,

   

  I actually prefer using a façade (which is you're doing) for a few reasons:

   

  1)       You're preventing direct access to the CFC. While I do use CFC for 
Webservices, the CFCs I expose are usually façades for an internal API with 
limited roles and access. 

  2)       Calling a CFC directly returns the results as WDDX (at least in CF7 
and earlier.) I prefer using JSON-because it's lighter weight. A simple data 
structure in WDDX can produce a pretty large data packet, where the same packet 
in JSON is considerable smaller.

  3)       I can build whatever additional error handling for the AJAX call 
into the façade. I mean, what happens if your CFC throws an error? I want to 
make sure that my AJAX calls now what do to if something funky happens.

   

  -Dan

   

Reply via email to