hide/toggle not working reliably

hide/toggle not working reliably

I have the following code, that for some strange reason will not execute the toggle code (near the bottom) every time through, and it seems to work on the second click.  Does anyone see an issue with my code that might be responsible for this? It's my belief that there is an issue with the way the file is being served, but I don't see how that makes sense.     Also setTImeout doesn't work as expected. I would expect it to not do anything for 3 seconds, but it starts making AJAX requests immediately.  Any insight is appreciated. 

  1.  $('#bayes-load').click(function(){
  2.                 var modelString = '';
  3. modelString = dataSource + '#';    
  4.                 modelString += model + ':Load'
  5.                 console.log(modelString);
  6.                 $.ajax({
  7.                 type: 'POST',
  8. url:'analytics.jsp',
  9.                 data:{q:modelString},
  10. beforeSend: function(){
  11.    $('#query-results').html('<img src="images/ajax-loader.gif"><p>Retrieving Model...</p>');
  12. }
  13. }).done(function recursionLoad(){     
  14.                 var timerLoad = setTimeout(function(){
  15.                         
  16.                     
  17.                     },3000)
  18.    
  19.                     $.ajax({
  20.                type:'GET',
  21.                url:'modelBN.xml',
  22.                beforeSend: function(){$('#query-results').html('<img src="images/ajax-loader.gif"><p>Loading...</p>'); },
  23.                timeout: 10000,
  24.                error: function(xhr, status, error){
  25.                 recursionLoad();
  26. //alert("Error: " + xhr.status + " - " + error)
  27.                },
  28.                dataType: 'xml',
  29.                cache:false,
  30.                success: function(data){
  31.                var html = '<h3>Nodes</h3><ul class="outer">';
  32.                $(data).find('node').each(function() { // Each node
  33.                var node = $(this);
  34.                html += '<li>' + node.find('name').text() + '<ul class="detail">'; // Embedded list
  35.                node.find('state').each(function() { // Each node state
  36.                html += '<li>' + $(this).text()
  37.                
  38.                var prob = $(this).attr('prob');
  39.                html += ': ' + prob;
  40.                prob = parseFloat(prob);
  41.                html +=  '<div style="height:8px; width:40px;" data-prob="' + prob*100 + '"></div>';
  42.                 
  43.                
  44.                
  45.                });
  46.             html += '</ul></li>'
  47.         });
  48.             html += '</ul>';
  49.         $('#query-results').html(html). // Add to DOM
  50.         on('click', '> ul > li', function() { // Toggle embedded display on click
  51.             $(this).find('ul').toggle();
  52.             $(this).toggleClass('minus');
  53.                 
  54.             
  55.             
  56.     }).find('ul ul').hide(); // Hide embedded initially

  57.         $("[data-prob]").each(function(){
  58.       $(this).progressbar({ value: $(this).data("prob") })
  59.       $(this).removeAttr("data-prob")
  60.         });
  61.             
  62.                }//end success
  63.                               
  64.            });//end ajax
  65.                 }); //end wrapper
  66.                     
  67.                     
  68.                     
  69.                 }); //end click