title: Need advice on using Grails and Ajax to append to a div like in Rails
body: <p>I'm just starting out in Grails and need some advice on using Ajax. I want to append some html to the bottom of a div inside a form. This is basically what I have:</p>
  
  <pre>
  -form-
    -div id="listOfchildren"-
     childrow 1 input fields 
     childrow 2 input fields 
     childrow 3 input fields
    -/div-
  -form-
  -a-Add Child 4-/a-
  </pre>
  
  <p>When I click on the "Add Child" I want to make an ajax call that results in a new childrow getting inserted into the "listOfchildren" div. So the document would look like this:</p>
  
  <pre>
  -form-
    -div id="listOfchildren"-
     childrow 1 input fields
     childrow 2 input fields
     childrow 3 input fields
     childrow 4 input fields
    -/div-
  -form-
  -a-Add Child 5-/a-
  </pre>
  
  <p>In Rails I would do something simple like this:</p>
  
  <pre>
    render :update do |page|
       page.insert_html :bottom, "list_of_children", :partial => child_partial
       page.replace "add_link", :partial => 'add_link'
     end
  </pre>
  
  <p>The previous code sends an javascript back to the browser with two commands. The first command tells the browser to append some html to the bottom of a div. The second command updates the "add link" counter. </p>
  
  <p>In grails I can only see how to replace an entire div (which would wipe out the user's existing input) and I don't see how I can call multiple functions from the ajax response. I can probably do this if I was to write some javascript functions in prototype or whatever, but I'd like to avoid that if there is a simpler way.</p>
  
  <p>Thanks!</p>
  
  <p>Nate</p>