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
library).

Thanks in advance.

On Sat, Jul 5, 2008 at 2:55 PM, Rock R.
[email protected] wrote:

the entire page without using rjs(i can use Prototype javascript
library).

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 Prototype API Documentation | Ajax.Request (Deprecated URL)

Mikel

Rails, RSpec and Life blog…

Mikel L. wrote:

On Sat, Jul 5, 2008 at 2:55 PM, Rock R.
[email protected] wrote:

the entire page without using rjs(i can use Prototype javascript
library).

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 Prototype API Documentation | Ajax.Request (Deprecated URL)

Mikel


http://lindsaar.net/
Rails, RSpec and Life blog…

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
Forum,
Student, Event, Teacher, etc with only the respective view templates for
the CRUD actions, appearing in the content area without complete page
refresh.

Rock R. 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
Forum,
Student, Event, Teacher, etc with only the respective view templates for
the CRUD actions, appearing in the content area without complete page
refresh.

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.

Peace,
Phillip

On Sat, Jul 5, 2008 at 4:41 PM, Rock R.
[email protected] wrote:

Mikel L. 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
Forum,
Student, Event, Teacher, etc with only the respective view templates for
the CRUD actions, appearing in the content area without complete page
refresh.

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:

Mikel

Rails, RSpec and Life blog…

On 05 Jul 2008, at 14:21, Phillip K. wrote:

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!

Phillip