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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:43:46+00:00 2026-05-27T12:43:46+00:00

I am trying to use ajax like below; jquery code: $(a.generate).click(function(){ $.ajax({ data: {tag:

  • 0

I am trying to use ajax like below;

jquery code:

$("a.generate").click(function(){
    $.ajax({
        data: {tag: $(this).html()},
        success: function(data){
            $("#terms div.content").html(data);
        }
    });
});

the link I call from:

<a href="#" class="generate"> tag </a>

after call, ajax loads the links that I can call again like below:

<a href="#" class="generate"> term </a>
<a href="#" class="generate"> term2 </a>

The problem is, if I click the links from ajax loaded data, ajax doesn’t load anymore.

edit:

After I edited the code with the on() method like below, the code does nothing:

$("body").on('click', 'a.generate', function(){
    $.ajax({
        data: {tag: $(this).html()},
        success: function(data){
            $("#terms div.content").html(data);
        }
    });
});

solved:

the jquery version, I have added in head tags were 1.6.2, I have updated the version, no problem now. thanks again.

  • 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-27T12:43:46+00:00Added an answer on May 27, 2026 at 12:43 pm

    Use on to add your event handlers.

    $(document).on("click", "a", function(){
    });
    

    This will wire up every single anchor that’s ever clicked. To be more selective, just pass in a selector for the second parameter

    $(document).on("click", "a.someClass", function(){
    });
    

    Note that live—a common suggestion for events in jQuery—is deprecated; on is the preferred way to add events that will also work with dynamically added content.

    Also, since on was added in jQuery 1.7, if you’re using an older version, you’ll have to use delegate. Note that the order of the selecter and event are reversed:

    $(document).delegate("a.someClass", "click", function(){
    });
    

    Here are the docs for on()

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

Sidebar

Related Questions

I'm trying to use jquery.Ajax to post data to an ASP.NET MVC2 action method
I am trying to use jQuery's ajax functionality to update data from a web
So I am trying to use jQuery to insert data from an ajax call.
I'm trying to use AJAX (not jQuery).... I basically have this going on. Content
I'm trying to use Ajax to fetch an HTML page and then pull out
I am trying to use jQuery to make a synchronous AJAX post to a
I'm trying to use ajax on a select box and change html elements with
I'm trying to use AJAX via jquery with ASP.NET MVC, but I'm not able
I'm trying to use Ajax with my CRUD. I'm following this tutorial . I
In my Rails app, I'm trying to use jQuery ajax to create a new

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.