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

  • Home
  • SEARCH
  • 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 8351295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:35:21+00:00 2026-06-09T08:35:21+00:00

The code below adds the html returned by returndatafromdb2() function in the server to

  • 0

The code below adds the html returned by returndatafromdb2() function in the server to the table that has id resultstable2. The html returned by the function returndatafromdb2() is of the form:

"<tr><td>some text</td><td>more text</td></tr><tr><td>some text</td><td>more text</td></tr><tr><td>some text</td><td>more text</td></tr>"

As you can see in the code I am using .load() from jquery to obtain the html from the server and add it to the table. The code I am using, however, replaces the existing rows in the table instead of adding to it. How can I use jQuery .load() function to add the rows to existing rows and not replace them?

If I can somehow assign the html received from the .load() function to a variable say newhtml, I can do something like $(newhtmltext).appendTo('#resultstable2'). But I don’t know how to assign the html obtained by .load() to a variable, or to use it as a string.

The Code:

Create table using jquery

<p>Method 2</p>

    <table id="resultstable2">
        <tr>
            <th>Grade</th>
            <th>Price</th>
        </tr>
    </table>

<button id="b2">Execute returndatafromdb2()</button>

<script type="text/javascript">

    $.ajaxSetup({
        cache: false
    });


    var getdata2 = function(){
        var loadurl2 = "{{=URL('default', 'returndatafromdb2')}}";
        $('#resultstable2').load(loadurl2));
    };

    $('#b2').click(getdata2);

</script>
  • 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-09T08:35:24+00:00Added an answer on June 9, 2026 at 8:35 am

    There isn’t a way to do it with the load() function. You will want to use the normal ajax calls and write your own callback function. Something like this:

    var getdata2 = function() {
    
        var loadurl2 = "{{=URL('default', 'returndatafromdb2')}}";
        $.get(loadurl2,function(data){
            $('#resultstable2').append(data);   
        },'html');
    
    };
    
    $('#b2').click(getdata2);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code below that creates a RelativeLayout and adds a button to
I have some code that adds a flag to an email but when I
The code below simply didn't work. document.getElementById('files').addEventListener('change', handleFileSelect, false); reported by firebug that this
I attempted to display adds using code below. I got the error AdView missing
The code below detects URL's in a body of text and wraps them in
I have an application that displays videos. The code below gets a list of
I have a simmple HTML table that I just cant seem to fix. I
I need some help in rendering a dynamic gridview. Using the source code below,
The code below adds totals of check boxes and gives a discount if ALL
Writing a code that does the following: Adds a mouse listener to a web-page

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.