Refresh g:each tag via AJAX call in Grails
<p>I have a statistical panel which displays the last registered users. I want to implement a AJAX call to upload the panel without having to reload the full page.</p>

<p><strong>I have the following code in my view</strong>:</p>

<pre><code>&lt;g:each in="${lastUsers}" var="user"&gt;
     &lt;div class="mt-comments"&gt;
         &lt;div class="mt-comment"&gt;
              &lt;div class="mt-comment-img"&gt;
                  &lt;g:if test="${user?.avatar}"&gt;
                       &lt;img src="${createLink(controller:'controllerUser',
                       action:'image', id: user?.id)}" /&gt;
                  &lt;/g:if&gt;
                  &lt;g:else&gt;
                       &lt;img class="img-circle"
                       src="${resource(dir: 'img/profile', file: 'user_profile.png')}"/&gt;
                 &lt;/g:else&gt;
              &lt;/div&gt;
              &lt;div class="mt-comment-body"&gt;
                 &lt;div class="mt-comment-info"&gt;
                     &lt;span class="mt-comment-author"&gt;${user?.username}&lt;/span&gt;
                     &lt;span class="mt-comment-date"&gt;
                        &lt;g:formatDate date="${user?.dateCreated}"/&gt;
                     &lt;/span&gt;
                 &lt;/div&gt;
                 &lt;div class="mt-comment-text"&gt;${user?.email}&lt;/div&gt;
                    &lt;div class="mt-comment-details"&gt;
                       &lt;g:if test="${user?.enabled}"&gt;
                       &lt;span class="mt-comment-status label label-sm label-success circle"&gt;
                       &lt;/g:if&gt;
                       &lt;g:else&gt;
                       &lt;span class="mt-comment-status label label-sm label-info circle"&gt;
                       &lt;/g:else&gt;
                       &lt;g:formatBoolean boolean="${user?.enabled}"/&gt;
                       &lt;/span&gt;
                       &lt;ul class="mt-comment-actions"&gt;
                         &lt;li&gt;
                             &lt;g:link controller="user" action="edit" id="${user?.id}"&gt;Edit&lt;/g:link&gt;
                         &lt;/li&gt;
                       &lt;/ul&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
         &lt;/div&gt;
    &lt;/div&gt;
&lt;/g:each&gt;
</code></pre>

<p>Also, I have a button when it is clicked calls the AJAX function. The Ajax function receives the data successful in JSON format. From there, I don't know upload my g:each tag.</p>

<p>I have tried the remoteFunction of Grails to use the upload attribute, but an error appears: <strong>No javascript provider is configured</strong> and I have searched the solution but anything works me.</p>

<p><strong>The AJAX call:</strong> </p>

<pre><code>$('.button').click(function() {

     $.ajax({
       url: URL,     
       success: function(data) {

          console.log(data[index]);
          console.log(val.username);
          console.log(val.dateCreated);
          console.log(val.email);
          console.log(val.enabled);
          console.log(val.avatar);
          console.log(val.id);
       },
       error: function(){
       },
     });
</code></pre>

<p>Thanks for helping me.</p>