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 ?