Help in AJAX page using partials

Hi. I am doing a web project for my school. I have models like Forum,
Student, Event, Teacher, etc. Users are allowed to go to these models
only after logging in so that they can view and update their details,
create events, topics in forums, etc.
    My page has a header, a menu bar, a content-container and a footer
in the page. The content container has a left sidebar and a content div
to contain the rendered content. The left side bar has links to Forum,
Student, Event, Teacher, etc inside a partial.This is contained in the
main layout. Everything is going fine. What i need to know is how can i
implement the same layout with only refreshing the content div and not
the entire page without using rjs(i can use Prototype javascript

Thanks in advance.

You need to research and learn about AJAX requests.

The function you are going to use for prototype is 'new Ajax.request('url...')'

Go read up on this at


Mikel Lindsaar wrote:

Yes, you can absolutely do this. I did it on an app. Only one page
and then all parts refreshing as you go.

It gets messy though.

You are better off doing the request response thing. For one thing,
the back button works again :slight_smile:


Rock Roll wrote:

Thanks for your reply. I know about implementing AJAX using rails using
the prototype helpers. But i want to use a single page for accessing
Student, Event, Teacher, etc with only the respective view templates for
the CRUD actions, appearing in the content area without complete page

The only way to do it without a page refresh is via AJAX, so you will
need to either (1) use an existing library which makes this easier
(Prototype, JQuery, or something else), or (2) reinvent the wheel and
write all of the JavaScript yourself.


... or worship the devil and resort to iframes.

Peter De Berdt wrote:

... or worship the devil and resort to iframes.

Heh heh :slight_smile:

I've always avoided iframes like the plague (and the devil :wink: ), so that
possibility didn't cross my mind.

Thanks Peter!