[Catalyst] AJAXPrototype Questions

Wade.Stuart at fallon.com Wade.Stuart at fallon.com
Thu Sep 8 16:52:31 CEST 2005


  $options->{html_options}->{method} ||= 'post'; ?

             "Christopher H.                                               
             <claco at chrislaco.                                          To 
             com>                      The elegant MVC web framework       
             Sent by:                  <catalyst at lists.rawmode.org>        
             catalyst-bounces@                                          cc 
                                       [Catalyst] AJAXPrototype Questions  
             09/08/05 09:28 AM                                             
             Please respond to                                             
             claco at chrislaco.c                                             
                om; Please                                                 
                respond to                                                 
              The elegant MVC                                              
               web framework                                               
             <catalyst at lists.r                                             

Is the AJAX/Prototype stuff in Catalyst GET based only, or can you also
specify POST as well?

While watching the autocomplete movie again, it's apparent that the
prototype stuff works cleanly if it's going to it's own url
[/autocomplete/suggest]. I'm more interested in retrofitting something
with AJAX, rather than it being AJAX only.

Here's a specific example. The Handel::Scaffold code from YAPC has a an
action at /cart/update/ to update the quantity of an item in the cart.

If you try to GET that url, nothing happens. You must POST to that url
to update an item. The same is true for /cart/delete/. I did that based
on the REST-ish ideas that changing data state is best left to POST and
never for GET requests.

Now, let's say I want to retrofit prototype on top of the Quantity box
in the cart so that it automatically calls /cart/update/ instead of the
user having to click the Update button manually when the quantity changes.

In theory, it's just a matter of loading the prototype stuff, and
observing the quantity field and sending it to /cart/update/. Of course,
if the prototype javascript does a GET, we'll get nowhere. It needs to
do a POST.

I guess I'm looking for more detail as to what magic goes on behind the
scenes of the prototype stuff.


Catalyst mailing list
Catalyst at lists.rawmode.org

More information about the Catalyst mailing list