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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:51:04+00:00 2026-05-23T02:51:04+00:00

I am building a table row in a jQuery $.ajax() call that builds a

  • 0

I am building a table row in a jQuery $.ajax() call that builds a row on successful execution of a PHP script.

I’m calling a function that builds a new table row based on the script results. Here is the function:

function addNewRow(addDocs, newClassID, classNumberAdd, classNameAdd) {

    var newRow = '';

    newRow += $('#classesTable tbody:last').after('<tbody>' + 
        '<tr bgcolor="#EFE5D3" style="font-weight: bold;">' +
            '<td width="35px"><a class="classEditLink" name="' + newClassID + '" href="#">Edit</a></td>' +
            '<td width="20px"><input type="checkbox" class="chkSelectToDelete" name="deleteClasses[]" value="' + newClassID + '" /></td>' +
            '<td>' + classNumberAdd + '</td>' +
            '<td>' + classNameAdd + '</td>' +
        '</tr>');

    if (addDocs == 'true') {

        $('#docsTable input[type="checkbox"]:checked').each(function() {
            var $row = $(this).parents('tr');
            var docID = $row.find('td:eq(0) input').val();
            var docName = $row.find('td:eq(1)').html();
            var docDescription = $row.find('td:eq(2)').text();

            newRow += $('#classesTable tbody:last').append('<tr class="classDocsRow">' +
            '<td></td>' +
            '<td align="right"><input type="checkbox" class="chkRemoveDocs" name="removeDocs[]" value="' + docID + '-' newClassID + '" /></td>' +
            '<td width="245px">' + docName + '</td>' +
            '<td width="600px">' + docDescription + '</td>' +
        '</tr>');
        });

//$('#classesTable tbody:last').append('<tr class="classDocsRow"><td></td><td align="right"><input type="checkbox" class="chkRemoveDocs" name="removeDocs[]" value="' + docID + '-' newClassID + '" /></td><td width="245px">' + docName + '</td><td width="600px">' + docDescription + '</td></tr>');

    } else {
        newRow += $('#classesTable tbody:last').append('<tr class="classDocsRow">' +
            '<td colspan="4">' +
                '<strong>No documents are currently associated with this class.</strong>' +
            '</td>' +
        '</tr>');
    }

    return newRow;
}

Aptana Eclipse IDE is reporting an error in two places in the “if (addDocs == 'true')” section: The first error, “missing ) after argument list“, is on the second line after “newRow += ...” and the second error “missing ; before statement” is two lines after that. Note that I also have that entire section in one line (not broken up with string concats) commented out shortly after that. That shows only one error, the error about missing a right paren.

If I comment out everything in the if clause and pass addDocs as false, the else clause returns a new row as expected.

This must be simply a js syntactic problem, but I can’t see what I’m doing wrong.

Any help will be greatly appreciated!

  • 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-23T02:51:04+00:00Added an answer on May 23, 2026 at 2:51 am

    You are missing the + here:

    ' + docID + '-' + newClassID + '" /></td>' +
                    ^
    

    The second error is probably just a result of the first error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a CGI script that polls a SQLite database and builds a table
I'm building a table with some text that is HTML, so I am using
I'm building a form with php/mysql. I've got a table with a list of
i need help building a function that display an associative array and i want
I have been building index on a 200 million row table for almost 14
I'm building a web app that displays a list of customers in a table.
I'm building application using pop-ups. I'm getting new information with Ajax in the main
I am building a table that spans multiple pages of my PDF. I would
I am writing a loop that is building a table. With a mysql_num_row ,
I have a huge html table that I am building dynamically, and I want

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.