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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:49:33+00:00 2026-05-29T19:49:33+00:00

I want to create an ajax delete call. When the link is clicked, the

  • 0

I want to create an ajax delete call. When the link is clicked, the confirm box should appear and then the p tag fades out (comment). The problem is just how the ajax call should be and how to show the confirm box.

HTML view:

<a rel="nofollow" data-method="delete" data-confirm="Er du sikker?" class="softdelete" href="/blogs/5/comments/18">slet</a>

jQuery:

<script type="text/javascript">
$(document).ready(function() {
    $('.softdelete').click(function () {
        var Url = $(this).attr('href');
        var Data = $(this).attr('data-method');
        $(this).closest('p').fadeOut(1000);
        $.post(Url);
        return false;
    });
});
</script>

When clicked on the delete link, the comment fades out, but it is not destroyed. Also no confirm box appeared.

  • 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-29T19:49:37+00:00Added an answer on May 29, 2026 at 7:49 pm

    You’re using a post request, so the action isn’t properly routed: Rails expects a delete request.

    Here is the way to proceed with jQuery:

    $.ajax({
      url: your_url,
      type: 'DELETE',
      success: function(result) {
        // Do something with the result
      }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a simple AJAX call, based on How to use Servlets
I want to create some kind of AJAX script or call that continuously will
i am new to ZF i want to create ajax link that will go
I want to create an AJAX call on an action, let's call it seen,
I want to create an interactive website using aspx and ajax, that there will
I'm trying to call ajax inside beforenodedrop event, and when success, I want to
I want to create a form (flash or java/ajax) that allows selection data to
I want to create tabs with jQuery and Ajax etc. I want to implement
I have 4 different groups of data that I want to: create, update, delete
here is my situation: I want to create an AJAX file-upload script, which will

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.