# Drop down menu and ajax calls

**URL:** <https://www.ruby-forum.com/t/drop-down-menu-and-ajax-calls/187923>\
**Category:** Rails\
**Created:** [May 2, 2010, 8:32am UTC](https://www.ruby-forum.com/t/drop-down-menu-and-ajax-calls/187923 "2010-05-02T08:32:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![amabdelsalam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/958977/32.png) [@amabdelsalam](https://www.ruby-forum.com/u/amabdelsalam)\
**Post date:** [May 2, 2010, 8:32am UTC](https://www.ruby-forum.com/t/drop-down-menu-and-ajax-calls/187923/1 "2010-05-02T08:32:10Z")

</div>

Hi,

I have a drop down menu that contains a set of menu items. Each menu  
item is planned to make ajax call to change the content of the page when  
it’s clicked. I used link\_to\_remote successfully to make the ajax call  
and update the specific div

However, After clicking the menu item, the menu doesn’t close, and it  
remains open. The contents already changed in the background, but the  
menu is still open, which hides a part of the page.

Any help?

---

<div class="post-metadata">

**Author:** ![amabdelsalam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/958977/32.png) [@amabdelsalam](https://www.ruby-forum.com/u/amabdelsalam)\
**Post date:** [May 2, 2010, 2:24pm UTC](https://www.ruby-forum.com/t/drop-down-menu-and-ajax-calls/187923/2 "2010-05-02T14:24:43Z")

</div>

Hi Ahmed,

On Sun, May 2, 2010 at 1:32 AM, Ahmed A.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)wrote:

> 

I’m not sure I understand what you mean ‘used link\_to\_remote…’. I’m  
imagining that you’ve coded the menu items themselves with the link. If  
so,  
that’s an interesting approach, but one that I’ve never tried. I’m  
guessing  
it might be why your menu is misbehaving. I use observe\_field on the  
select, passing the selected value to render the new content. You might  
try  
that to see if yields better results.

Best regards,  
Bill
