javascript repeat action
<p>how to do a same loop action? thank you.</p>

<pre><code>$('a.level').click(function() {
var level   = $(this).parent('li').attr("class");
var nxvl    = parseInt(level)+1;
var dir     = $(this).html();

var curr    = $(this);

var data = new Object();
    data.n      = new Date().getTime();
    data.act    = "getdirectory";
    data.level  = level;
    data.direct = dir;

var str = $.toJSON(data); 
$.post('ajax.php', { str: str }, function(result){
    var data = eval('('+obj.data+')');
    var html = [];
    $.each(data, function(key, value) {
        html[key] = "&lt;li class='"+nxvl+"'&gt;&lt;a href='javascript:void(0);' title='' class='level'&gt;"+eval(value)+"&lt;/a&gt;&lt;ul&gt;&lt;/ul&gt;&lt;/li&gt;";
    });

    $(curr).next('ul').html(html.join(""));
    $('a.level').click(function() {

        // do the same action
    }

});
return(false);
</code></pre>

<p>});</p>
