# Activate a tab after an ajax call

**URL:** <https://www.ruby-forum.com/t/activate-a-tab-after-an-ajax-call/137338>\
**Category:** Rails\
**Created:** [May 12, 2008, 6:47am UTC](https://www.ruby-forum.com/t/activate-a-tab-after-an-ajax-call/137338 "2008-05-12T06:47:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![skg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/76d3ee/32.png) [@skg](https://www.ruby-forum.com/u/skg)\
**Post date:** [May 12, 2008, 6:47am UTC](https://www.ruby-forum.com/t/activate-a-tab-after-an-ajax-call/137338/1 "2008-05-12T06:47:40Z")

</div>

Hi  
My main file(edit\_sd\_ticket\_ui.rhtml) has the following format  
(differnt tabs)

- Details
- Resolution
- Attachments

 \<%= render :partial=\>'service\_desk\_part/edit\_sd\_details' %\>

 \<%= render :partial =\> 'service\_desk\_part/ view\_sd\_resolution\_details' %\>

 \<%= render :partial =\> 'service\_desk\_part/view\_sd\_attachment\_details'%\>
\<% activeTabNo=(params[:activeTab].nil?)?0:params[:activeTab]%\>

So here always first tab highlighted.Now i am calling an ajax function  
link\_to\_remote from bottom of the file and before that takes place I  
have to activate the second tab( ie tab for Resolutions) .How can i do  
this?I tried with :before with link\_to\_remote .But how?I have a  
javascript function for expanding the tab  
expandtab(“sd\_ticket\_view\_main\_tab”, \<%= activeTabNo %\>)…But for that  
I have to reload the page…How can I do without reloading the page  
after(before) this ajax call ?

Sijo

---

<div class="post-metadata">

**Author:** ![skg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/76d3ee/32.png) [@skg](https://www.ruby-forum.com/u/skg)\
**Post date:** [May 12, 2008, 9:22am UTC](https://www.ruby-forum.com/t/activate-a-tab-after-an-ajax-call/137338/2 "2008-05-12T09:22:23Z")

</div>

Try changing the class of the two tabs before the ajax call in the  
javascript.
