Thanks Jack, that helps a lot. So much that I nearly got it to work :)

I hoped to get it working with the validation plugin but I gave up trying 
after a few hours. The problems I had was 1) every time I included config 
info i.e. $.AjaxCFCHelper.setDebug(false), the page refused to load and 2) 
when the page did load and I submitted my form firebug reported:

jquery.AjaxCFC.js (line 165):
JSON is not defined

I wish I had more time, it would be incredibly useful to return queries etc.

Thanks again.

----- Original Message ----- 
From: "Jack Killpatrick" <[EMAIL PROTECTED]>
To: <jquery-en@googlegroups.com>
Sent: Friday, May 25, 2007 8:15 PM
Subject: [jQuery] Re: ColdFusion, ajax, post, jquery and whitespace



Oh yeah, and of course include the path to jquery.AjaxCFC.js in your HTML:

<script type="text/javascript"
src="../js/ajaxCFC/jquery.AjaxCFC.js"></script>

- Jack

Jack Killpatrick wrote:
>
> Hi Gareth,
>
> Here are the basics:
>
> 1. add ajaxCFC to your CF project (or somewhere that it can get to).
>
> 2. create a CFC that extends AJAXCFC.ajax:
>
> <cfcomponent extends="AJAXCFC.ajax">
>
>    <!--- security stuff --->
>    <cfscript>
>        setAllowedVerbs('POST');
>        setCheckHTTPReferer(true);
>    </cfscript>
>
>    <cffunction name="myFunction" output="no" access="private">
>         do some CF stuff
>        <cfreturn something />
>    </cffunction>
> </cfcomponent>
>
> For the cfreturn, you can return queries, structs, pretty much any cf
> object (see the docs for any limitations, I've had good success having
> cfreturn return structs, arrays of structs, queries, etc).
> AJAXCFC.ajax will handle converting the "something" that you are
> returning to the requested format (see #3):
>
> 3. Add config info to your js file/script (see docs for full set of
> config options):
>
> $.AjaxCFCHelper.setDebug(false);
> $.AjaxCFCHelper.setUseDefaultErrorHandler(false);
> $.AjaxCFCHelper.setSerialization('json'); // json, wddx
>
> 4. call the remote CFC:
>
>        $.AjaxCFC({
>            url: "path/file.cfc", // your CFC
>            method: myFunction,
>            data: {},
>            success: function(data){ showResults(data); }
>        });
>
> showResults is called on success and data contains the json data. Use
> Firebug or something to see what the format of the json data is (it's
> very compact and gives you recordcount and colnames if you're
> returning query data).
>
> - Jack
>
>
> Gareth Hughes wrote:
>> I'd like to see those code snippets Jack :) I looked at ajaxCFC a
>> while back but didn't have time to figure things out so seeing some
>> examples would be a great help.
>>
>>
> .....
>
>


Reply via email to