title: Grails - render Map from controller via Ajax using JSON
body: <p>I know this is a recurrent/classical topic but I did not found anything that helped me so far. 
  I am trying to render a Map from my controller. This results from an Ajax request and is supposed to be "eaten" by a Javascript function 'onSuccess'. </p>
  
  <p>Here is my <strong>Javascript</strong> and <strong>.gsp view</strong>: </p>
  
  <pre><code>&lt;g:javascript&gt;
  function updateVideoLoad(e) {
  var map = eval("("+e.responseText+")") // evaluate the JSON
  $('#resultsChecker').html(map.urlAccepted + ' - ' + map.provider + ' - ' + map.videoId + ' - ' + map.videoTag)
  }
  &lt;/g:javascript&gt;
  &lt;g:formRemote name="myForm" update="" url="[controller: 'project', action:'addVideo']" onSuccess="updateVideoLoad(e)"&gt;        
      ...      
  &lt;/g:formRemote&gt;
  </code></pre>
  
  <p>Here is my <strong>controller</strong>:</p>
  
  <pre><code>    import grails.converters.JSON
  
  class ProjectController {
  
      def addVideo() {
         ...
      def videoMap = [urlAccepted: videoList[0], provider: videoList[1], videoId: videoList[2], videoTag: videoList[3]]
      render videoMap as JSON
      }
  </code></pre>
  
  <p>It looks to me exactly as the example provided in the <a href="http://file:///var/lib/grails-doc-2.0.0/guide/theWebLayer.html#ajaxOnTheServer" rel="nofollow">Grails documentation</a>.
  However it does not work. On the browser console, I get:</p>
  
  <pre><code>Uncaught ReferenceError: e is not defined
  </code></pre>
  
  <p>from my <code>g:remoteForm</code>. </p>
  
  <p>Any suggestion is most welcome.
  Thank you for your help.</p>