How to correctly do jquery tree in rails app?
===

I'm using jqTree-plugin. What i want is to to "ajax-like" tree view, so that if I click on parent, i get parent id to controller, and there format childrens, and send them to view (js). But how to correctly do that?
Here is my js:

    $(document).ready(function() {
    /*var data = [
        {
            label: 'node1',
            children: [
                { label: 'child1' },
                { label: 'child2' }
            ]
        },
        {
            label: 'node2',
            children: [
                { label: 'child3' }
            ]
        }
    ];*/
    $(function() {
        $('#tree1').tree({
            data: data
        });
    });
    
    $.getJSON(
        '/search_trees/catalog/cat='+$(this).attr("id")+"&type=16184",
        function(data) {
            $('#tree1').tree({
                data: data
            });
        }
    );
    });

My view:

    ....
    %table.zebra
          %tr
            %th Наименование
          - @search_trees.each do |search_tree|
            %tr{ :class => cycle("zebra zebra1", "zebra zebra2")} 
              %td= link_to search_tree.getname(search_tree.designation_id), {:controller => "search_trees", :action => "getpartsviatype", :type => @type, :cat => search_tree.STR_ID}, :class => 'catalog', :id => search_tree.STR_ID
    ....

And conrtoller method:

    ....
        require 'json'
        @search_trees = SearchTree.find(:all, :include => [:designation], :conditions => { :STR_ID_PARENT => params[:cat]})
        data = "{ label : 1,  children : [{label : 1},{label : 1}]  }"
        respond_to do |format|
          format.html # index.html.erb
          format.xml  { render :xml => @search_trees }
          format.json { render :json => data }
        end
    ....

But how to format this json, so that jqtree understand it, and how to correctly send it to js? Now if i lick on link_to, i get to another page, where are all childrens (html like), but how to do in tree-way? so that i don't need to go to another page, but if i click on parent, i send param to controller, and controller send json to js?