[Catalyst] AJAXPrototype Questions

Christopher H. Laco claco at chrislaco.com
Thu Sep 8 16:28:03 CEST 2005


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.

Thanks.
-=Chris



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3178 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20050908/a5303d84/smime.bin


More information about the Catalyst mailing list