Briefly (I'm on my way out to go fishing)... There are two common (and very different) approaches to doing AJAX with ModelGlue. Because the CF8 form tags can be bound to CFC methods that are marked access="remote" (via URL or dot.path.notation.to.CFC), or any other URLs or dot-path notation to a CFC method, eitherof the following should work. Since you're asking about ways to use MG with AJAX, these aren't the only ways to do it, but they're definitely the most common.
1) Set up an event that broadcasts messages and includes a view that formats the data as JSON or XML. Have your AJAX do a POST or a GET to that event and pick up the generated text as your result. This is good for small sites and simple tasks where returning a "view" of your data is good enough to be maintainable. It's also probably the fastest and most straightforward way to make it work. And, FWIW, since your data is being pulled by the model and spit out in either JSON or XML (which are both effectively text-based documents) I really don't feel that this violates any rules of OO programming or patterns. It's a perfectly valid way to pull a text-based representation of your data into your views via AJAX. 2) Use ColdSpring remoting to create remote proxies for model objects controlled by ColdSpring itself. This allows you to call any of your service methods on your service layer without changing the code in your services to allow remote calls. I don't know if you're familiar with them or not, but the essence is that ColdSpring will generate CFCs that you can use as a binding source in your AJAX code, and those CFCs will allow you to call any objects available within your ColdSpring config. More info on this topic here: http://www.coldspringframework.org/coldspring/examples/quickstart/ index.cfm?page=remote Either is good, 1 works best for simpler sites and smaller tasks. 2 is best for large, complex sites and takes a healthy degree of understanding to get it to work in the first place. Laterz, J On Nov 9, 2008, at 2:15 PM, Tom Bishop wrote: > Hi, > > I'm trying to find any info about a presentation made by Todd Sharp > at cf.Objective() earlier this year on the subject of Integrating > ColdFusion 8 AJAX with Model-Glue Applications. Unfortunately, > CFSilence, which is the only place that seems to have this info, is > down at the moment. > > Otherwise, any pointers to any resources about best practices with > ajax and MG would be greatly appreciated. > > Many thanks, > Tom --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "model-glue" 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/model-glue?hl=en For more about Model-Glue, check http://www.model-glue.com . -~----------~----~----~----~------~----~------~--~---
