Hi i am building a jquery accordion menu using VS2008 and MVC2.
My requirement is to refresh the contents of the accordion and repopulate it when a user selects an item from a dropdownlist
For this i am using a jquery ajax call which returns data with and tags like below
<h3>
<a href="#">Masters</a>
</h3>
<div>
<ul>
<li>
<a href="#" onclick="pageclick('..\TRAN\EmpMst.aspx',1)">Employee Master</a>
</li>
<li>
......
...
The first time on page load the accordion looks fine. But whenever i change the contents dynamically it looks awfull with weird CSS

here is my ajax call
$('#moduleList').change(function() {
var rootPath = '<%=Url.Content("~/")%>';
$.ajax({
type: "POST",
url: rootPath + "Home/GetMenu/",
data: { moduleid: $(this).val() },
success: function(result) {
$('#accordion').html(result);
//$('#accordion').append(result);
$('#accordion').accordion('destroy');
$('#accordion').accordion({
fillSpace: true, collapsible: true
});
},
error: function(error) { alert(error); }
});
});
am i doing something wrong ?
Thanks everybody for your help. I finally got it right. Actually i missed a little CSS.
My IE was not showing the html with any css at all. So it was difficult to findout whether something is changed or not. Thanks to Tuan who saved my day. Once i started using Firebug it was crystal clear that a custom css was missing. Here is the updated Code just in case any one is interested.
And Here is the CSS for the Accordion menu items.