I don't have anything publically available at the moment, but it's pretty
straightforward.  For example, to update a div (Status) with a query
recordcount, then dump the results of that query into a table (ListBody) on
the same page, the client side is as simple as:

function updateList() {
        $.AjaxCFC({
          url: "/some.cfc",
          method: "GetContacts",
          data: jsListObj,
          success: function(data){
          $.taconite(data);
          }
        });
}

The jsListObj could also be a form field value, array or whatever.  It is
kind of nice to pass a structure (js object) to ajaxCFC so you can use named
arguments though.

Server side could be:

<cffunction name="GetContacts" output="no" access="private">
        <cfset list = arguments>
                
        <cfquery name="GetData" datasource="#DSN#">
        SELECT fields
        FROM database
        WHERE name LIKE '%#list.name#%'
        </cfquery>

        <cfsavecontent variable="taconite">
        <taconite> 
                <replaceContent
select="#Status"><cfoutput>#getData.recordCount#</cfoutput></replaceContent>
                <replaceContent select="#ListBody">
                <cfoutput query="getData">
                <tr><td align="left">#xmlformat(field1)#</td><td
align="left">#xmlformat(field2)#</td><td
align="center">#xmlformat(field3)#</td><td></td></tr>
                </cfoutput>
                </replaceContent>
        </taconite>
        </cfsavecontent>

        <cfreturn taconite />
</cffunction>

If you need a formal, functioning example I can whip something up - let me
know.


Rey Bango-2 wrote:
> 
> Daemach,
> 
> I'd be interested in seeing a sample of AjaxCFC for jQuery using 
> taconite. Its something that I'm sure Rob Gonda would love to include in 
> his sample apps for AjaxCFC.
> 
> Can you email me a sample?
> 
> Rey
> 
> Daemach wrote:
>> By the way, Mike Alsup just released a new plugin for jQuery called
>> taconite
>> that blends some of the best of CF and jQuery. Traditional ajax
>> programming,
>> for more complex operations such as building tables, interacting with DOM
>> elements, etc. requires quite a bit of work and occasionally multiple
>> operations to do what you need.  Taconite is a nice bridge - I'll let him
>> explain further:  http://www.malsup.com/jquery/taconite/
>> 
>> BTW, with this method you can get by with using $.ajax() as he describes,
>> pulling the taconite objects straight from a .cfm page.  I still use
>> ajaxCFC
>> to handle the ajax side because I like the flexibility of going with
>> whichever method is best suited for the job and because I like keeping
>> specific functions wrapped in component methods. 
>>   
>> 
>> Rick Faircloth wrote:
>>> A question for you CF & jQuery coders.
>>>
>>> What's the best (easiest) way to work with AJAX?
>>>
>>> ColdFusion or jQuery?
>>>
>>> Why?
>>>
>>> I would appreciate your insights.I haven't used AJAX, yet,
>>> but I'm really interested in trying to figure it out.  It would
>>> be especially useful in some of the web-based apps that I'm
>>> building that would be used in place of traditional software.
>>> Being able to avoid page changes and page refreshes would
>>> go a long way in helping me sell people on the apps.
>>>
>>> Rick
>>>
>>> _______________________________________________
>>> jQuery mailing list
>>> [email protected]
>>> http://jquery.com/discuss/
>>>
>>>
>> 
> 
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Best-way-to-do-AJAX...-CF-or-jQuery--tf3276462.html#a9114042
Sent from the JQuery mailing list archive at Nabble.com.


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

Reply via email to