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
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
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
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
This method works, when a new item is selected from the second menu, the
I’m using this but I don’t know how to update only a
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 …