Ajax responses


#1

I’m doing a custom page, and I’d like to respond to some Ajax
requests in my custom process method. I haven’t been able to find an
example of this yet, and I’m wondering if anyone who has done it
would like to volunteer a snippet of code as a guide.


Building an e-commerce site with Rails?
http://agilewebdevelopment.com/rails-ecommerce

Meet up at RailsConf:
http://railsconf2007.conferencemeetup.com/


#2

On 5/4/07, Benjamin C. removed_email_address@domain.invalid wrote:

I’m doing a custom page, and I’d like to respond to some Ajax
requests in my custom process method. I haven’t been able to find an
example of this yet, and I’m wondering if anyone who has done it
would like to volunteer a snippet of code as a guide.

A “custom page” means you are extending Radiant with a custom
controller? If
so, implementing Ajax in your site will be trivial. Do you need help on
the
server side, or help with JavaScript? I can show you how to leverage the
Prototype framework real easy.


#3

On May 4, 2007, at 11:36 AM, Mislav Marohnić wrote:

On 5/4/07, Benjamin C. removed_email_address@domain.invalid wrote:
I’m doing a custom page, and I’d like to respond to some Ajax
requests in my custom process method. I haven’t been able to find an
example of this yet, and I’m wondering if anyone who has done it
would like to volunteer a snippet of code as a guide.

A “custom page” means you are extending Radiant with a custom
controller? If so, implementing Ajax in your site will be trivial.
Do you need help on the server side, or help with JavaScript? I can
show you how to leverage the Prototype framework real easy.

No, it’s not a custom controller. I may yet take that route, if I
must, but by “custom page” I meant I have created an extension that
has a model that inherits from Page and overrides process.


#4

Ben,

Your process method will have access to the request object. If it’s an
Ajax request, request.xhr? will return true.

Sean