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 6942345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:00:14+00:00 2026-05-27T13:00:14+00:00

I need to pass an entire html table content and trying to pass it

  • 0

I need to pass an entire html table content and trying to pass it as a param to the next gsp page in the ajax call

jQuery.ajax({
          type:'POST',
          data:{'table_cart': $("#table_cart").html()},
          url: '/gra/ar_request/nextpage',
          beforeSend: function() {
                   jQuery('#templateDiv').html('show spinner')
                },
          success:function(data,textStatus){jQuery('#templateDiv').html(data);},
          error:function(XMLHttpRequest,textStatus,errorThrown){}});
    return false;

when I try to retrieve the value in the next page I am getting all kinds of errors like “XML not formed properly, expecting img tag., ; missing ..etc”

I am just trying to do following to read the value on next page

var table_content = ${table_cart}

giving single quotes around the value gives error. Ineed to know how to pass the html content of a table to another gsp, is there a better way?

Details of the error on nextpage.gsp
missing ; before statement
http://cdn.jquerytools.org/1.2.6/full/jquery.tools.min.js
Line 29

I am doing 
<script>
    var tbcont = ${rolecart}
</script>

I printed out the content on console from the action and it has the right content. i.e. all tags inside the table, do i need to encode the html content?
exact display of the content from the console is:

<thead>
                <tr>

                  <th scope="col" style="width: 40%">
                    <span class="column-sort">
                      <a href="#" title="Sort up" class="sort-up"></a>
                      <a href="#" title="Sort down" class="sort-down"></a>
                    </span>
                  Role
                  </th>
                  <th scope="col" style="width: 55%">
                    <span class="column-sort">
                      <a href="#" title="Sort up" class="sort-up"></a>
                      <a href="#" title="Sort down" class="sort-down"></a>
                    </span>
                 Description
                  </th>
                </tr>
              </thead>
              <tbody>

              <tr class="odd">

                    <td style="width: 40%;"><span style="color: black;">unix_server_read</span></td>
                    <td style="width: 55%;"><span style="color: black;">Role with UNIX based entitlements having read access</span
></td>
                </tr><tr style="color:black"></tr><tr style="color:black"> <td colspan="1">End Date: <input style="width:70px" nam
e="ar_enddate" value="" id="ar_enddate" type="text"><img src="images/icons/fugue/calendar-month.png" height="16" width="16"></td><
/tr><tr style="height:8px"></tr><tr class="even">

                    <td style="width: 40%;"><span style="color: black;">unix_server_write</span></td>
                    <td style="width: 55%;"><span style="color: black;">Role with UNIX based entitlements having write access</spa
n></td>
                </tr><tr style="color:black"></tr><tr style="color:black"> <td colspan="1">End Date: <input style="width:70px" nam
e="ar_enddate" value="" id="ar_enddate" type="text"><img src="images/icons/fugue/calendar-month.png" height="16" width="16"></td><
/tr><tr style="height:8px"></tr></tbody>
  • 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-05-27T13:00:15+00:00Added an answer on May 27, 2026 at 1:00 pm

    Do not pass html back to the server. Instead, extract the relevant parameters (using <g:form>) and rerender the content of the file in your AJAX call.

    You can achieve this with grails by extracting the content of your table into grails-template file. This way you can render the content of the table in your AJAX call.

    In your main gsp file, your table will look like:

    <table>
         <g:render template="yourTableContent" model="${[..]}" />    
    </table>
    

    With a _yourTableContent.gsp file located at the same location as your gsp is located in.

    In your action called from the client you can then call:

    def nextpage = {
        [..]
        render(template:"yourTemplateContent", model: [...])
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to pass an array from JavaScript to a page method in C#.
I need to pass data to a variable in my master page each time
I need to pass an ID and a password to a batch file at
I need to pass a regex substitution as a variable: sub proc { my
I need to pass a pointer through a scripting language which just has a
I need to pass audio data into a 3rd party system as a 16bit
I need to pass configuration settings to an AddIn created using the Managed AddIn
I need to pass an object (my own business object) between two tables in
I need to pass multiple arguments to a function that I would like to
I need to pass the $route to its inner function,but failed: function compilePath( $route

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.