[jQuery] Ajax based Accordion
Hi;
I have been creating an accordion application whose content has been
loading by ajax, code sample like below:
$("#loading").ajaxStart(function(){ $(this).show();});
$("#loading").ajaxStop(function(){ $(this).hide();});
$.getJSON("ajax.php",{ task: "shops", cid: cid }, function(json)
{
if (json == "") return
$('<dl id="shops">').appendTo("#leftcontent")
for (var i = 0; i < json.length; i++) {
$("<dt>"+json[i].name+"</dt>").appendTo("#shops");
$("<dd>"+json[i].name+"</dd>").appendTo("#shops");
}
$('</dl>').appendTo("#leftcontent")
$('#shops').Accordion();
});
As you see I created the necessary content on-the-fly and then
initiate the Accordion with $('#shops').Accordion();
There is no with content, it seems ok, but I cannot succeed to
initiate the accordion
What's the problem?