[jQuery] AjaxCFC (paging Rey Bango...)

[jQuery] AjaxCFC (paging Rey Bango...)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.5730.11" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV dir=ltr align=left><SPAN class=820550421-06022007><FONT face=Arial
color=#0000ff size=2>Just so you know, you CAN use jQuery to hit the CFC
directly. Here's a sample of code I'm using:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=820550421-06022007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=820550421-06022007><FONT face=Arial
color=#0000ff size=2>js code:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=820550421-06022007><FONT face=Arial
color=#0000ff size=2>function addRecipe(id)
{<BR> $.get("includes/q.cfc?method=addRecipe&id=" +
id,function(result){<BR>  eval( 'var ' + result
);<BR>  $('#shoppingList').html(r.content);<BR> });<BR>};</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=820550421-06022007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=820550421-06022007><FONT face=Arial
color=#0000ff size=2>CFC:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=820550421-06022007><FONT face=Arial
color=#0000ff size=2><cffunction name="addRecipe" access="remote"
returntype="void" hint="Adds a recipe to your shopping
list"><BR> <!--- set parameters for arguments
---><BR> <cfargument name="id" required="Yes"
type="numeric"><BR> <cfset myStruct =
structNew()><BR> <cfif NOT
ListFind(SESSION.grocerylist,id)><BR>  <cfset
SESSION.grocerylist =
ListAppend(SESSION.grocerylist,id)><BR> </cfif><BR> <cfset
myStruct["content"] =
Replace(getShoppingList(),"#chr(13)#","","ALL")><BR> <cfwddx
action="CFML2JS" input="#myStruct#"
toplevelvariable="r"><BR></cffunction></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=820550421-06022007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=820550421-06022007></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=820550421-06022007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> discuss-bounces@jquery.com
[mailto:discuss-bounces@jquery.com] <B>On Behalf Of </B>Christopher
Jordan<BR><B>Sent:</B> Tuesday, February 06, 2007 2:28 PM<BR><B>To:</B> jQuery
Discussion.<BR><B>Subject:</B> Re: [jQuery] AjaxCFC (paging Rey
Bango...)<BR></FONT><BR></DIV>
<DIV></DIV><FONT size=-1><FONT face="Courier New, Courier, monospace">I like
that with AjaxCFC, I don't have to reinvent the wheel and can instead use my
CFCs directly. True I can still use them, but I've got to have jQuery's in-built
ajax methods call a .cfm page which in turn calls my cfc. I'd like to cut out
the middle man and go directly to the CFC. Thanks to Rob's hard work on AjaxCFC
I can do this.<BR><BR>Chris<BR></FONT></FONT><BR>Michael E. Carluen wrote:
<BLOCKQUOTE cite=mid008001c74a2a$cf285fc0$0200a8c0@mcb130 type="cite"><PRE wrap="">Hi Andy... are you referring to the one that returns a wddx packet from the
cfc using the $.get() directly? As for AjaxCFC, I think I just like the
thought of having the extra layer of Error Trapping and Security Check
features for CFCs that Rob put in place. What's your thoughts?
Thanks, Andy.
</PRE>
<BLOCKQUOTE type="cite"><PRE wrap="">-----Original Message-----
From: <A class=moz-txt-link-abbreviated href="mailto:discuss-bounces@jquery.com">discuss-bounces@jquery.com</A> [<A class=moz-txt-link-freetext href="mailto:discuss-bounces@jquery.com">mailto:discuss-bounces@jquery.com</A>] On
Behalf Of Andy Matthews
Sent: Tuesday, February 06, 2007 11:44 AM
To: 'jQuery Discussion.'
Subject: Re: [jQuery] AjaxCFC (paging Rey Bango...)
Michael...
Have you seen how easy it is to access a CFC directly using jQuery? Dirt
simple.
-----Original Message-----
From: <A class=moz-txt-link-abbreviated href="mailto:discuss-bounces@jquery.com">discuss-bounces@jquery.com</A> [<A class=moz-txt-link-freetext href="mailto:discuss-bounces@jquery.com">mailto:discuss-bounces@jquery.com</A>] On
Behalf Of Michael E. Carluen
Sent: Tuesday, February 06, 2007 1:18 PM
To: 'jQuery Discussion.'
Subject: Re: [jQuery] AjaxCFC (paging Rey Bango...)
Paul, on simple data retrieval, I find pure jQuery's $.ajax(), $.post(),
and
$.get() more than sufficient especially when used with .cfm files.
AjaxCFC's however would be my preference when I need to invoke my cfc's...
of course when its out of alpha. As Rey said, it's a case-by-case. My
.02
Paul.
</PRE>
<BLOCKQUOTE type="cite"><PRE wrap="">-----Original Message-----
From: <A class=moz-txt-link-abbreviated href="mailto:discuss-bounces@jquery.com">discuss-bounces@jquery.com</A> [<A class=moz-txt-link-freetext href="mailto:discuss-bounces@jquery.com">mailto:discuss-bounces@jquery.com</A>]
On Behalf Of Paul
Sent: Tuesday, February 06, 2007 11:12 AM
To: 'jQuery Discussion.'
Subject: Re: [jQuery] AjaxCFC (paging Rey Bango...)
That's exactly what I'm looking for, Rey. I've already got my feet
wet with jQuery's UI tools, so it sounds like AjaxCFC may be a great
way to handle the Ajax stuff.
Thanks for the insight.
-----Original Message-----
From: <A class=moz-txt-link-abbreviated href="mailto:discuss-bounces@jquery.com">discuss-bounces@jquery.com</A> [<A class=moz-txt-link-freetext href="mailto:discuss-bounces@jquery.com">mailto:discuss-bounces@jquery.com</A>]
On Behalf Of Rey Bango
Sent: Tuesday, February 06, 2007 11:57 AM
To: jQuery Discussion.
Subject: Re: [jQuery] AjaxCFC (paging Rey Bango...)
Hi Paul,
I'm so used to doing things sans AjaxCFC for jQuery that I would
probably stick with straight jQuery since its what I'm most accustomed
to and I love having greater control over how things are handled.
But I'm very torn because Rob's done a GREAT job of abstracting jQuery
via AjaxCFC and the functionality he's included such as serialization
(js, json & wddx), logging, and CF-based error reporting really
attractive.
So I'd really have to evaluate things on a case by case basis. I don't
think you can go wrong by using AjaxCFC, especially in the beginning
where it may make using jQuery much easier for Ajax call manipulation.
Remember that AjaxCFC isn't there to help you with UI controls or DOM
manipulation. Its biggest feature is the ability to access CF data
types easily and work with them during an XMLHttpRequest. You're still
going to have to dig into the jQuery API in order to handle non-Ajax
functionality.
Rey...
Paul wrote:
</PRE>
<BLOCKQUOTE type="cite"><PRE wrap="">Thanks Rey, I found the jQuery example code in the SVN branch.
I know you've been pretty excited about jQuery for a while now--your
</PRE></BLOCKQUOTE><PRE wrap="">mention
</PRE>
<BLOCKQUOTE type="cite"><PRE wrap="">of it on the HOF CF list is why I picked it up. Since the AjaxCFC
</PRE></BLOCKQUOTE><PRE wrap="">change
is
</PRE>
<BLOCKQUOTE type="cite"><PRE wrap="">still in Alpha you obviously haven't been using it up to this point
but
</PRE></BLOCKQUOTE><PRE wrap="">I
</PRE>
<BLOCKQUOTE type="cite"><PRE wrap="">wonder if you were to start a new project now, would you adopt
AjaxCFC
</PRE></BLOCKQUOTE><PRE wrap="">or
</PRE>
<BLOCKQUOTE type="cite"><PRE wrap="">just do things the way you have been? I need to start on the
server-
</PRE></BLOCKQUOTE><PRE wrap="">side
</PRE>
<BLOCKQUOTE type="cite"><PRE wrap="">implementation of a project and want to make an informed decision if
I can...
Thanks again.
Paul
-----Original Message-----
From: <A class=moz-txt-link-abbreviated href="mailto:discuss-bounces@jquery.com">discuss-bounces@jquery.com</A> [<A class=moz-txt-link-freetext href="mailto:discuss-bounces@jquery.com">mailto:discuss-bounces@jquery.com</A>]