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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:44:05+00:00 2026-05-29T05:44:05+00:00

I have some weird problems with jQuery ajax. I am calling jQuery ajax function

  • 0

I have some weird problems with jQuery ajax. I am calling jQuery ajax function by .hover event and it is working fine.I am getting some response and I am displaying that response in div.

But if I want to call jQuery on <a> which has come as response from previous jQuery ajax call by .click event, I can not call it.

Can anyone help me out in this?

This is jQuery ajax function ..

function call_jqry_ajx(file_name,show_div_id,function_name,parameter){
    $.ajax({
        type: "POST",
        url: file_name,
        data: parameter,
        success: function(msg){
            alert( "Data Saved: " + msg ); //Anything you want
            $("#show_div").html(msg);
            alert("Done with div..");
        }
    });
}

   $(document).ready(function () 
   {
    $(".a_class").click(function(){
        alert("double times called but still getting alert.. :)");
        return false;
    });
});

in my div I get response like this ..

<div id="show_div">
      <a class="a_class" id="a_id">Call Anchor</a>
</div>

I can not execute my jQuery function a tag’s link

  • 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-29T05:44:06+00:00Added an answer on May 29, 2026 at 5:44 am

    You are registering for the click event before the object is actually present in the page. Thus, it doesn’t get an event handler assigned to it.

    To remedy that, you should use either .delegate() (for pre-jQuery 1.7) or .on() (for jQuery 1.7+) to use delegated event handling. This registers for the event on a parent object of the actual content that will generated the event. You pick a parent object that is there at the beginning when you register the event and then event bubbling allows events in newly created objects to be captured.

    You can change your code to this:

    $(document).ready(function () {
        $('#show_div').on('click', '.a_class', function(){
            alert("double times called but still getting alert.. :)");
            return false;
        });
    });
    

    This registers for the click event on the #show_div object, but only triggers the event handler if the event originated on an object that matches the .a_class selector. Thus objects inside of #show_div can come and go and the event handler will stay in place.

    See the jQuery doc for more info on .on(). This replaces .live() which is now deprecated, but used to be the preferred way of doing this.

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

Sidebar

Related Questions

I have a weird problems with NSArray where some of the members of the
I have a large data.frame displaying some weird properties when plotted. I'd like to
I'm having some issues with a jQuery AJAX call. My code works fine when
I have the weirdest of problems. I have a jQuery function that animates the
I have experienced a weird problem with javascript. The problem page uses some jQuery
I have some extremely weird behavior that seems to result in silent exceptions. How
I have seen some very weird for loops when reading other people's code. I
I have this exported file of some weird (standard for this industry!) format, which
I have been tasked to read in some data from some weird old system.
I'm having some weird trouble with a project on VS2005. I have a few

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.