title: How to render multiple object as JSON and how to retrieve that object from <g:javascript> in Grails?
body: <p>Actually I want to add two select boxes in <strong>results</strong> div using Ajax.I have function called <strong>ajaxFun</strong> for retrieving values for that two select box. I am trying to render multiple objects as JSON.but I dont know how to render and how to retrieve rendered objects from my javascript function.</p>
  
  <p>My GSP page.</p>
  
  <pre><code>&lt;table&gt;
  &lt;tr&gt;
  &lt;td&gt;&lt;div id="test" onclick="${remoteFunction(controller:'ProjectOperations', action:'ajaxFun', update:'results',onComplete:'getFields(e)',params:'\'filter=\' + escape(this.id)' )}"&gt;click me!&lt;/div&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;div id="results"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Controller class</p>
  
  <pre><code>import grails.converters.JSON
  
  class ProjectOperationsController {
  
      def ajaxFun(){
                  def project="Hill"
                  def company="VK"
          def operation=Operation.findAllByProject_name(project)
          def staff=StaffDetails.findAllByCompany_name(company)
  
          render operation,staff as JSON//am not sure 
      }
  }
  </code></pre>
  
  <p>here i want to render two list [operation and staff respectievely..].
  Then also I want to know how to retrieve the rendered objects from javascript function.</p>
  
  <p>Javascript function</p>
  
  <pre><code>&lt;g:javascript&gt;
    function getFields(e){ 
  // here I want to retrieve that two objects.
   } 
   &lt;/g:javascript&gt;
  </code></pre>