List multiple ul within a li using AJAX

0

How can I list multiple ul within a li , dynamically, with AJAX?

Something like ul>li>ul>li>ul>li

The question arose because I'm making a linear network of an MMN system and I can not dynamically load ul after the first li .

    
asked by anonymous 30.09.2014 / 16:41

1 answer

1

If I understand correctly, you want to dynamically put a <ul> inside a <li> returned by AJAX and if I understand correctly you want to do it with JQUERY. I put here an example that responds to what I understood in the question.

html:

<ul id="teste">
    <li></li>
    <li></li>
</ul>

No JQUERY:

$("ul#teste li").each(function () {
    var retorno_ajax = "<ul><li>sub-linha1</li><li>sub-linha2</li></ul>";
    $(this).html(retorno_ajax);
});

each accesses dynamic content as well. Do not forget that .html will delete the previous content and put the new one for the example. However if you want to add the return to existing content within li then use append .

    
30.09.2014 / 19:45