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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:38:45+00:00 2026-06-10T04:38:45+00:00

i have a jQuery tab with ajax loading. <script type=’text/javascript’> $(document).ready(function() { $(#nav li

  • 0

i have a jQuery tab with ajax loading.

<script type='text/javascript'>
$(document).ready(function() {
    $("#nav li a").click(function() {

        $("#ajax-content").empty().append("<div id='loading'><img src='{THEME}/images/loading.gif' alt='Loading' /></div>");
        $("#nav li a").removeClass('current');
        $(this).addClass('current');

        $.ajax({ url: this.href, success: function(html) {
            $("#ajax-content").empty().append(html);
            }
    });
    return false;
    });
});
</script>

HTML Code:

<ul id="nav">
  <li><a href="test1.html">Page 1</a></li>
  <li><a href="test2.html">Page 2</a></li>
</ul>
<div id="ajax-content">This is default text, which will be replaced</div>

everything is fine and working well, but i need something else.

i just need to get contents from div with answer ID in test1.html and test2.html.
i dont wanna load all the pages.

in those pages i have a div for my answers, my test1.html page:

<div>Questions</div>
Some Questions

<div id="answers">Some answers</div>

i just need to show and get contents from id=”answers”
how i can do this?

And how i can add fadein effect after contents is loding?

  • 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-10T04:38:46+00:00Added an answer on June 10, 2026 at 4:38 am

    Replace your $.ajax() call with this:

    var location = this.href +" #answers";
    $("#ajax-content").load(location);
    

    See the jQuery ajax .load() documentation on loading page fragments.


    Full code:

    $(document).ready(function() {
        $("#nav li a").click(function() {
    
            $("#ajax-content").html("<div id='loading'><img src='{THEME}/images/loading.gif' alt='Loading' /></div>");
    
            $("#nav li a").removeClass('current');
            $(this).addClass('current');
    
            var location = this.href +" #answers";
            $("#ajax-content").load(location);
    
            return false;
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jQuery tab, and this is my code: $(document).ready(function() { //When page
jquery ui tabs supports loading content through ajax here but if i have already
I have a jQuery tab script that gets content from a PHP file defined
I have a jQuery tab script that gets content from a PHP file defined
I have a jQuery tab script that gets content from a PHP file defined
I have used jquery tabs for loading data with ajax, but I need to
I'm using jQuery UI tabs, loading the tab content via ajax. Content may contain
I have the following jQuery code: $.ajax({ type: POST, url: /search, data: $(form).serialize(), success:
Possible Duplicate: Detect all changes to a <input type=text> (immediately) using JQuery I have
I have a form in a jQuery tab div that is loaded with AJAX:

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.