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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:16:54+00:00 2026-05-15T14:16:54+00:00

how can i have the functionality of load() except i want to append data

  • 0

how can i have the functionality of load() except i want to append data instead of replace. maybe i can use get() instead but i want to just extract the #posts element from the loaded data

UPDATE

when i do an alert(data) i get …

<!DOCTYPE HTML>
<html lang="en-US">
<head>
  <meta charset="UTF-8">
  <title></title>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  <script src="jquery.infinitescroll.js"></script>
  <script>

  </script>
</head>
<body>
  <div id="info"></div>
  <div id="posts">
    <div class="post"> ... </div> 
    ...
  <ul id="pageNav" class="clearfix">
    <li><a href="page1.html">1</a></li>
    <li><a href="page2.html">2</a></li>
    <li><a href="page3.html">3</a></li>
    <li><a href="page4.html">4</a></li>
    <li><a href="page5.html">5</a></li>
    <li><a href="page3.html" class="next">next</a></li>  
  </ul>

the full code can be found @ pastebin

  • 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-15T14:16:55+00:00Added an answer on May 15, 2026 at 2:16 pm

    There’s no reason you can’t extract the element you want using $.get().

    $.get('test.html',function(data) {
        var posts = $(data).find('#posts');
           // If the #posts element is at the top level of the data,
           //    you'll need to use .filter() instead.
           // var posts = $(data).filter('#posts');
        $('#container').append(posts);
    });
    

    EDIT:

    You perhaps didn’t notice the code comments above, so I’m going to make it more explicit here.

    If the #posts element is at the top of the hierarchy in data, in other words if it doesn’t have a parent element, you’ll need to use .filter() instead.

    $.get('test.html',function(data) {
        var posts = $(data).filter('#posts');
        $('#container').append(posts);
    });
    

    EDIT:

    Based on the comments below, you seem to need .filter() instead of .find().

    The reason is that you’re passing in an entire HTML structure. When you do that, jQuery places the direct children of the body tag as the array in the jQuery object.

    jQuery’s .filter() filters against only the nodes in that array. Not their children.

    jQuery’s .find() searches among the descendants of the nodes in the array.

    Because of this, you’re needing to use both. .filter() to get the correct one at the top (#posts) and .find() to get the correct descendant (.next).

    $(data).filter('#posts').find('.next');
    

    This narrows the set down to only the #posts element, then finds the .next element that is a descendant.

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

Sidebar

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.