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'',
parameters:''size=normal''});
In my Controller:
@gallery_size = params[:size] unless params[:size].nil?
I would be eternally grateful for any response.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
I forgot to mention that I have this encapsulated in a function that is triggered by the page loading: Event.observe(window, "load", start); -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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
session.
Main Layout:
<body onload="new
Ajax.Request(''/main/set_width?client_screen_height='' +
clientScreenHeight(), {asynchronous:true, evalScripts:true}); return
false;">
Controller:
def set_width
session[:client_screen_height] = params[:client_screen_height]
end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---