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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:24:17+00:00 2026-06-05T04:24:17+00:00

I receive no errors from either jshint or console for this code. Yet, my

  • 0

I receive no errors from either jshint or console for this code. Yet, my ajax content does not post to the intended div(s). The alerts, however, fire:

    var recentVar;
    var highlightsVar;
    var test3;
    var test4;

function switcher(divToShow, thisVar, otherVar, url, div){
    $("#site-nav li a").parents().removeClass("nav-active");
        $(div).addClass("nav-active");
        if (otherVar){ $(otherVar).detach();}

        if(typeof thisVar === 'undefined') {
            thisVar = $(divToShow + " ul.top-level").load("assets/includes/" + url, function () {
                alert("I'm new");
            });
        } else {
            $(thisVar).appendTo("#content-listing");
            alert("I'm old");
        }
}

    //Recent
    $("#site-nav .nav1").on("click", function (event) {
    switcher("#recent", "recentVar", "highlightsVar", "recent.php", "#site-nav .nav1");
    event.preventDefault();
    });

    //Highlights
    $("#site-nav .nav2").on("click", function (event) {
    switcher("#highlights", "highlightsVar", "recentVar", "all-web.php", "#site-nav .nav2");
    event.preventDefault();
    });
  • 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-05T04:24:18+00:00Added an answer on June 5, 2026 at 4:24 am

    It has nothing to do with AJAX, but I think your issue is here.

    $(thisVar)
    

    thisVar is simply text. If you check, you will see that $(thisVar).length is 0. This is because you are calling: $("recentVar"), which will search for any elements of type <recentVar></recentVar>, which clearly there are none. If your intent is to append that text, you can use append or create an element and set the text to recentVar and append that.

    EDIT: Another issue:

    $(divToShow + "ul.top-level")
    

    You need a space here:

    $(divToShow + " ul.top-level")
    

    Otherwise you are trying to match #recentul.top-level which is nonsense.


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

Sidebar

Related Questions

I did not make any changes on the code. I dont receive any errors
From what I know, a blocking receive on a TCP socket does not always
I get an error with my code to receive data from my android app.
whenever I compile my code, I receive the following errors: error: constructor Player in
Update: With guidance from am no I am, I've solved this; working code at
When I specify targetNamespace in XML Schema, I receive errors (MS Visual Studio Editor
I always receive type missmatch errors or division by zero errors while trying to
I receive string {success: false, errors: { reason: 'text text text' }} by CURL,
I receive an error when trying to get a certificate hash from a remote
Hi i've been working on a task of porting some code from some old

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.