jQuery AutoComplete for hierachical field
===

I learned  [Autocomplete to Populate Another Autocomplete][1] and tried to implement it. My code not working. error message shows "ui.item" undefined. if I replace "item" with "val", it says "val is null". 
Any help is much appreciated!

    jQuery(document).ready(function ($){
    	var suggest_action = 'suggestion_source';
    	$('#parent-id').val("");    
        $("#child").attr('disabled', true);
                 
        $("#parent").autocomplete({
            source: function(req, add){
    
    			$.getJSON(SuggestHMC.url+'?callback=?&action='+suggest_action, req, function(data) {
    				var suggestions = [];
    				$.each(data, function(i, val){								
    					suggestions.push({
    	                    label:   val.name,
    	                    term_id: val.term_id,
    	                    count:   val.count
    	                });
    					
    				});
    				
    				add(suggestions);
    				
    			});
    		},
    		
            select: function(event, ui) {
            	$('#parent-id').val(ui.item.term_id);
                $("#child").attr('disabled', false);
            },
            
            change: function(event, ui){
                secondary_url = SuggestHMC.url+'?callback=?&action='+suggest_action+'&parent=' + ui.item.parent-id ;
                $("#child").autocomplete("option", "source", secondary_url);
            }
        });
                 
        $("#child").autocomplete({
            source: "",
            minLength: 2,
            select: function(event,ui){
            	$('#child').val(ui.item.child);    
            }
         });
                 
    });


  [1]: http://www.jensbits.com/2010/05/29/using-jquery-autocomplete-to-populate-another-autocomplete-asp-net-coldfusion-and-php-examples/