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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:31:20+00:00 2026-06-16T02:31:20+00:00

I have an AJAX call as such : $(‘a.delete_task’).live(‘click’, function() { $this = $(this);

  • 0

I have an AJAX call as such :

    $('a.delete_task').live('click', function() {
      $this = $(this);

      function deleteFunction(){            

        var obj = $this.parents('.task');
        $(obj).addClass('highlighted');

        $.post($this.attr('href'), { _method: 'delete' }, function(data) {
          if ( $single_item_collection == true ) {
          } else {
          };
        });
      };

      SSK.confirm_delete($this, deleteFunction, "task");
      return false;
    });

And then I take my deleteFunction() and throw it into the delete_confirmation :

$(function(){
  window.SSK = new(Class.extend({
  confirm_delete: function(obj, action, label){
    $(".confirm-deletion").live("click", function(){
      action.call(obj);
      $(this).parents("#delete-message").fadeOut();
      return false;
    });
  }, 

The problem is that when I click it the first time it works. When I click it the second time, it passes through the first $(this), and the second $(this). Likewise, when I click another item for a third time, it tries and pass all three and so on.

Somehow it is caching $(this). As crazy as that is. And passing it everytime the method is passed again.

Confirm delete as a function creates a popup and passes the method of the link you originally clicked to it as the variable obj.

Then if you click confirm it does this :

    $(".confirm-deletion").live("click", function(){
      action.call(obj);
      $(this).parents("#delete-message").fadeOut();
      return false;
    });
  • 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-16T02:31:22+00:00Added an answer on June 16, 2026 at 2:31 am

    You are adding a click event to the element ‘confirm-deletion’ every single time the user clicks ‘delete_task’. That’s why the click event is firing multiple times, it’s literally been added multiple times.

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

Sidebar

Related Questions

When a button is clicked I have a jquery AJAX call such as: $(.play).click(function(){
I have the following ajax call var prev_sibling = $(this).prev().attr(value); var next_sibling = $(this).next().attr(value);
I have an ajax call that fires multiple times but is called once. function
I have a function in a web application that makes an AJAX call to
I have 3 ajax call in one function and checkAjaxCompletion which checks each ajax
I have an ajax call in my code. What I want to achieve with
i have an ajax call $.ajax({ url: '<%=Url.Action(SaveDetails,Survey) %>', dataType: 'JSON', cache: false, data:
I have an AJAX call getting info out of the Github API. It is
I have an ajax call. I put the return value (data) in a variable
I have a ajax call on my onkeyup event, that checks if the given

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.