Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8792449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:58:49+00:00 2026-06-13T22:58:49+00:00

I am new to grails and could not find a solution to this. Whenever

  • 0

I am new to grails and could not find a solution to this.

Whenever Create Client is clicked on I would like to populate the main-content div with the contents of the partial template _client.gsp.

I have the following gsp page admin.gsp

<!DOCTYPE html>
<html>
  <head>
    <title>Admin Create</title>
<meta name="layout" content="main"/>
  </head>
  <body>
    <aside class="sidebar span3">

      <ul class="nav nav-list">
        <li class="nav-header">Admin Console</li>
        <li class="create-client"><a href="#">Create Client</a></li>
        <li><a href="#">Library</a></li>
      </ul>
    </aside>

    <div class="main-content span7">
    </div>

    <g:javascript src="admin.js"/>
  </body>
</html>

I have a partial template called _client.gsp

<g:hasErrors bean="${client}">
  <div class="alert alert-error alert-block client ">
    <g:renderErrors bean="${client}" as="list" />
  </div>
</g:hasErrors>
<g:form controller="admin" action="createClient">               
  <div class="row">
    <legend>Create Client</legend>
      <div class="span4">
        <label>Client Name:</label>
        <g:textField name="client.name" />
      </div>
      <div class="span4">
        <label>Client Type:</label>
        <g:textField name="clientType.type"/>
      </div>
      <div class="span4">
        <label>External Id:</label>
        <g:field type="number" required="" min="0" value="1" name="client.externalId"/>
      </div>
    </div>
  </div>    
</g:form>

my admin.js looks like this

$(function(){
  $('.create-client').on('click', function(e){
    e.preventDefault();
    $('.create-client').addClass('active');
    $('main-content').load('_client.gsp');
  });
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:58:50+00:00Added an answer on June 13, 2026 at 10:58 pm

    First, create a controller that serves up the template content for an AJAX call:

    class AdminController {
        def client() {
            render template: 'client',
                model: [...],
                contentType: 'text/plain'
    
        }
    }
    

    This renders the contents of _client.gsp as a string and returns it with a text/plain content type. In your javascript, call this with load:

    $('.main-content').load('/myapp/admin/client');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Grails development. I have a domain class like this : class
I'm still new to grails, so I'm really sorry for asking something like this.
Hi, I am new to the Grails platform... I could create the User, Role
I create a new grails app and do grails install-plugin rest . App builds.
I am currently working on a Grails project and would like to know the
I've created a domain class in Grails like this: class MyObject { static hasMany
I have a Grails 1.3.7 domain class that is declared like this: class Document
I have a grails project that is throwing the following exception: org.springframework.dao.DataIntegrityViolationException: could not
I'm new to grails, but have previous experience using .net with c# and linq
I am new to grails. I am using grails 1.3.7, and spring security core

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.