Ajax.request -> Controller Variable?

The amount of frustration that this has caused me has prompted me to
seek outside help. I know answer is right in front of me, but after
pouring over API documents and dozens of forum posts the answer still
eludes me:

I have a javascript func that detects the dimensions of the client
browser, I know I need to use an ajax.request to get the information
back to the controller - but for the life of me I cannot figure out how
to do that.

In my View:
new Ajax.Request(’/main/gallery’, {asynchronous:true, method:‘get’,

In my Controller:

@gallery_size = params[:size] unless params[:size].nil?

I would be eternally grateful for any response.

I forgot to mention that I have this encapsulated in a function that is
triggered by the page loading:

Event.observe(window, “load”, start);

I finally solved the issue. Calling it in the body instead of on the
actual gallery page solved the problem, as well as just throwing it in a

Main Layout:


def set_width
session[:client_screen_height] = params[:client_screen_height]