Ajax - adding to ul

I have a form and a ul and the form is submitting a new li for the
unordered list. It puts the right info into the MySQL database, but it
won’t insert properly into the list. Also, the link to show the form
stops working and it just says [object XMLHttpRequest] where the form
used to be and the unordered list is unchanged.

The view: Parked at Loopia (Pastie, for some odd reason,
repeated some commas and >'s (like , instead of , and =>>>>>>>>
instead of =>, hence the link to the txt version).

The method: Parked at Loopia

The partial used in add_todo_item:

  • <%= link_to @item.name, :action
    => ‘todo_item’, :id => @item %>
  • The javascript update function: Parked at Loopia

    I really have no idea what is wrong and trying to use Firebug in Firefox
    (I generally use Camino) is useless because it ignores using Ajax and
    tries actually going to a page.

    Thanks in advanced.

    Try looking at link_to_remote

    link_to_remote @item_name, :url => { :action => ‘todo_item’, :id =>
    @item }, :update => ‘your_list’

    Im new to the ruby world myself, but, unless I’m mistaken, link_to
    renders an entirly new page while link_to_remote works with the Ajax
    functionality to render just a specific part in the page. The :update
    attribute tells link_to_remote what part of the page, with that id, you
    are updating. Hope this helps,

    ~S

    I’m so dumb, I had TWO things with the id of “todo” (I forgot I had some
    header stuff). It works now.