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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:33:34+00:00 2026-06-14T14:33:34+00:00

I have the following ajax call on a webpage… var href=$(‘.poplight’).attr(href); $(‘.poplight’).attr(href,#); $(‘.poplight’).click(function(){ $.get(href,

  • 0

I have the following ajax call on a webpage…

    var href=$('.poplight').attr("href");
    $('.poplight').attr("href","#");
    $('.poplight').click(function(){
        $.get(href, function(data) {
                $("#popup-contents").html(data) 
                    // inserts <div id="additionalInfo"> 
                    // <legend id="legend-params">Legend</legend>
                    // <div id="toggle"> This should toggle </div> </div>

            }
        );
    });

</script>

On the same page, there is a .js script linked that toggles the #toggle div whenever the legend is clicked. This all works fine on a separate page (just the legend toggle by itself), but I can’t get it to work with the ajax call. I’m thinking it has to do with when jquery “attaches” to certain doms… I don’t know enough about the innerworkings of jquery to really know for sure.

Here is the external script. I’ve tried with an onload, adding it inline with html, and a few other variations. These functions are run when the legend is clicked (if you insert an alert(‘test’) after the .show() method, it will display an alert window).

$('#toggle').hide();                                            
$("#legend").toggle(
    function() {
       $("#toggle").show("slide", {direction: "up"}, 200);
    }, 
    function() {
       $("#toggle").hide("slide", {direction: "up"}, 200);
});

Any help would be great!

  • 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-14T14:33:35+00:00Added an answer on June 14, 2026 at 2:33 pm

    The comments listed above helped me solve the problem (I think they were converted to comments by SO’s “algorithm”… would have marked them as answers).
    I essentially changed:

    $(“#legend”).toggle(…)
    to

    $(“#legend”).on(‘click’, functionX()…)
    where functionX that was pretty much a glorified if statement that hid some things if a global variable was true or false. Maybe not the cleanest solution, but it did the job.

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

Sidebar

Related Questions

I have the following ajax call: $(#welcome a.close).click(function(e) { $.ajax({ type: GET, url: /visitors/hide_welcome,
I have the following ajax call var prev_sibling = $(this).prev().attr(value); var next_sibling = $(this).next().attr(value);
The problem is the following. We have lots of ajax call via $.ajax function.
I have the following code to make a jsonp call. var contacts; $.ajax({ url:
I have a AJAX call from my webpage sending the following data to my
Environment used: ASP.NET, jQuery I have the following AJAX call: var tempVar = JSON.stringify({plotID:currentId});
I have the following Ajax call: function ajaxCall(soap, url){ // Post SOAP request. $.ajax({
I have the following ajax call to webservice to pass json data and get
If I have the following ajax call (inside a function) how do I go
I have the following ajax call in a function, which is called upon a

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.