Problem using ajax tabs and accordion on 2 different tabs

Problem using ajax tabs and accordion on 2 different tabs

Hi guys,

I am having a problem using JQuery UI Tabs widget and Accordion widget.
The problem:
- I have a page with 4 tabs that are loaded via ajax, 2 of them have accordions inside a div.
- On these 2 pages, they initially load normally, then if the user click a button, a jquery script does a post, then does a html(data) on that div with the data that came from the post. This data contains the same html elements that wore there before (including the script that initializes the accordion) but with updated data. 
- If I visit any tab BUT the first one with accordion, all works great (no matter how many ajax posts updates the accordion portion of the page).
- If I visit the first tab with accordion, then the second one does render the accordion normally, but when I update it via the ajax post, it does not render the accordion, as if I did not called the $('.selector').accordion() code.

A little more data:
- Each accordion has its own id.
- If I alter the order of the tabs, the problem still happens on the second tab. For example, suppose the 2 tabs are "Categories" and "Products", then the problem happens on the "Products" tab. If I alter the tabs order to "Problems" and "Categories" then the problem happens on the "Categories" tab.
- If i call ($('accordionSelector').hasClass('ui-accordion') == true) it returns true.

What I already tried, but did not work:
- Changed the id of the accordions to be a different one on each request, hopefully avoiding cache problems.
- Changed the tabs() options, disabling cache.
- Changed the post() code to 'destroy' the accordion before calling the html(data) on the div that helds the accordion.
- Changed the post() code to call 'refresh' on the accordion, after it has been created.
- A lot of other probably non-sense changes to the scripts, css, etc. like calling 'refresh' to the tabs, destroying the accordion when the tab was unselected, etc

What I am using (scripts imported in this order)?
- jQuery 1.10.1 (tried with 1.9.1 too, no luck)
- bootstrap
- jQuery UI - v1.10.3
- jgrowl

Browsers tested with the same result:
- Firefox 21.0
- Chrome 27.0.1453.116 m

------------------------

Any ideias? Can it be a JQuery issue?

Thanks for any tips!!