Thanks Adam, I was able to simply pick a few key points in your blog and make my ajax work. The only thing I don't like is that for each controller action I have to have a view to simply echo out the json array. Do you know of a way to force the controller action to use a specific view rather than the default join -> join.html?. Thanks for the help thus far.
Happy Coding! On May 31, 11:09 am, Adam Royle <[EMAIL PROTECTED]> wrote: > This tutorial is for the Ext JS framework but the theory of ajax > related info is the same. > > http://blogs.bigfish.tv/adam/2008/02/12/drag-and-drop-using-ext-js-wi... > > Cheers, > Adam > > On May 31, 3:18 pm, Luciano <[EMAIL PROTECTED]> wrote: > > > Hi guys, > > > I have an app that I wrote using Cake and I have a decent > > understanding of the Cake principles and techniques. However, I > > started to make some of my actions ajax driven and still haven't been > > able to successfully complete the process. I red through tons of > > posts and tried to glue together bits and pieces of some people who > > don't use the built in spriptaculous and use a different library (ie. > > jquery) but haven't had much luck making it work. Below is my > > scenario: > > > JavaScript code (YUI): > > > // Make the call to the server for JSON data > > YAHOO.util.Connect.asyncRequest('POST','<?php echo $html->url('/ > > organization/join/'.$organization['id']); ?>', callbacks); > > > // My callbacks > > var callbacks = { > > > success : function (o) { > > > // Process the JSON data returned from the server > > var messages = []; > > try { > > messages = YAHOO.lang.JSON.parse(o.responseText); > > } > > catch (x) { > > alert("JSON Parse failed!"); > > return; > > } > > > // The returned data was parsed into an array of > > objects. > > // Do whatever here > > > }, > > > failure : function (o) { > > if (!YAHOO.util.Connect.isCallInProgress(o)) { > > alert("Async call failed!"); > > } > > }, > > > timeout : 3000 > > } > > > Questions: > > 1 - What should I have in my beforeFilter() for this controller? > > 2 - How do I get the action to return a Json only? > > 3 - Do I have to add any .ctp file or modify routes.php? > > > I appreciate if someone could provide me with all the things needed to > > get a json object back from an AJAX request. > > > PS: I am using 1.2 beta, thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
