Dynamic menu via AJAX

hello, im implementing a Category and subcategory. However, it archieve
it using only 1 model with the gem ‘awesome_nested_set’ ,so when i click
my first collection_Select,it will process my ajax and return a instant
variable for my controller and get the category for the second
collection select.
I almost done it ,but left some little problem,

  1. when i load the page , it give me error “might expect an instant of
    array”
    i knw why this come from ,its because ,when i load the page ,it actually
    load the js, but initialy, i havent click the first collection_select,do
    i cannot get the value from the select and my controller cannot get the
    params from there too.
    2.i did try to dont run the partial ,but my firebug console show me red
    color ,but i see it can get the params from the first collection_select
    edy.

Here is my gist.gihub


full code is provided, please guide me ,i need some modification then
can do it edy… @@