I have two drop-down menus in a page.
the first has only two values, and when one of those two values is
selected, an AJAX call is made to RoR.
there, I fetch some rows from the database, and fill the second
drop-down menu.
but, from this second drop-down menu, I also want to make another AJAX
call and fill some data in a Div.
The second drop-down menu fills correctly, but never fires the AJAX
call.
First I thought it was because the second drop-down menu didn''t exist
in
the page, and the second observer couldn''t find in when the page was
loaded.
For testing purposes, I created also the second pop-up with some
ficticious data, and the AJAX call worked, so I suppose the second
observer is working as expected.
Also I updated this false second drop-down menu with the new one, coming
from the first AJAX call, but the same as before, this drop-down menu
never fires the AJAX call.
I''m sure the id of the select is good.
What I''m thinking, is that an observer that has to observ a not yet
created object, maybe can''t work, and no matter if the object existed,
because when the first AJAX call replaces the other, even with the same
id, it also dosn''t.
So, my workaround is creating the second drop-down menu with the option
OnChange=:someJavascriptMethod();
This method works, when a new item is selected from the second menu, the
javascript method fires, but I don''t know how to make a call using
AJAX,
I''m using this but I don''t know how to update only a <Div
id=some></Div>
''function year_function()
{
var popup = document.getElementById("user_year");
location.href = ("/user/change_year?year="+popup.value) ;
}''
=> any clue on how to send the response to an object, like a Div, ...?
I know this question is more for an AJAX forum, but as I''m creating
with
the RoR helpers ...
:-)
thanks,
raimon
--
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
-~----------~----~----~----~------~----~------~--~---