Small world, Andy.  Just last week my wife tried to get me to build a tool
to generate shopping lists from her monthly menu. (I said I didn't have
time.)

 

Thanks again for the information.

 

  _____  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Andy Matthews
Sent: Tuesday, February 06, 2007 3:11 PM
To: 'jQuery Discussion.'
Subject: Re: [jQuery] AjaxCFC (paging Rey Bango...)

 

Most of the time, I'm using the CFC to do all of the formatting, then I
return a simple string containing all of the HTML that needs to be applied
to the page. For example. take a look at www.co-opcookbook.com. That's where
I pulled that sample code from.

 

When you perform a search, it runs the CFC using the provided keyword. The
CFC queries the database, loops over the results, adding in the appropriate
HTML, then returns that long string of  text to the calling JS function.

 

That might not be the most efficient way of doing things (if it's not PLEASE
someone speak up, I want to get better), but it's the way that makes sense
to me.

 

  _____  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Paul
Sent: Tuesday, February 06, 2007 4:05 PM
To: 'jQuery Discussion.'
Subject: Re: [jQuery] AjaxCFC (paging Rey Bango...)

Andy, this is also good to know.  I guess I'll figure this out eventually,
but what doesn't yet make sense is how to handle complex objects (queries,
structs) being returned from the CFC.  Do you just handle the formatting in
your CFC so you can pass back (or simply output, I guess) a string and use
$("#element").html() to replace the content, or do you handle formatting on
the client side?  (By "you" I mean Andy specifically but the rest of you
generally as well.)

 

I'm learning a lot.

 

Paul

 

 

  _____  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Andy Matthews
Sent: Tuesday, February 06, 2007 2:07 PM
To: 'jQuery Discussion.'
Subject: Re: [jQuery] AjaxCFC (paging Rey Bango...)

 

Just so you know, you CAN use jQuery to hit the CFC directly. Here's a
sample of code I'm using:

 

js code:

function addRecipe(id) {
 $.get("includes/q.cfc?method=addRecipe&id=" + id,function(result){
  eval( 'var ' + result );
  $('#shoppingList').html(r.content);
 });
};

 

CFC:

<cffunction name="addRecipe" access="remote" returntype="void" hint="Adds a
recipe to your shopping list">
 <!--- set parameters for arguments --->
 <cfargument name="id" required="Yes" type="numeric">
 <cfset myStruct = structNew()>
 <cfif NOT ListFind(SESSION.grocerylist,id)>
  <cfset SESSION.grocerylist = ListAppend(SESSION.grocerylist,id)>
 </cfif>
 <cfset myStruct["content"] =
Replace(getShoppingList(),"#chr(13)#","","ALL")>
 <cfwddx action="CFML2JS" input="#myStruct#" toplevelvariable="r">
</cffunction>

 

 

 

 

 
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to