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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:05:12+00:00 2026-06-13T02:05:12+00:00

I have a table where each row has a button for deletion. Actually I

  • 0

I have a table where each row has a button for deletion. Actually I delete the row everytime without checking if the ajax call was successfull. How can I achieve that, so that the row will only be deleted if the ajax call was ok.

Here is my clickhandler on each row

$("body").on('click', ".ui-icon-trash" ,function(){

    var $closestTr = $(this).closest('tr');  // This will give the closest tr
                            // If the class element is the child of tr          
    deleteRowFromDB(oTable, closestTr);
    $closestTr.remove() ;  // Will delete that
 });

And here my ajax call

function deleteRowFromDB(oTable, sendallproperty){

        var deleteEntryRoute = #{jsRoute @Application.deleteConfigurationEntry() /}
        console.log("route is: " + deleteEntryRoute.url)
        $.ajax({
           url: deleteEntryRoute.url({id: sendallproperty}),
           type: deleteEntryRoute.method,
           data: 'id=' + sendallproperty
        });
  • 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-13T02:05:13+00:00Added an answer on June 13, 2026 at 2:05 am

    Call it in the success callback function of your Ajax request

    $.ajax({
             url: deleteEntryRoute.url({id: sendallproperty}),
             type: deleteEntryRoute.method,
             data: 'id=' + sendallproperty.
             success : function() {
                 // Your code here
            }
         });
    

    EDIT

    $("body").on('click', ".ui-icon-trash" ,function(){
    
        var $closestTr = $(this).closest('tr');     
        deleteRowFromDB(oTable, $closestTr);
    });
    
    function deleteRowFromDB(oTable, sendallproperty){
    
       var deleteEntryRoute = #{jsRoute @Application.deleteConfigurationEntry() /}
       console.log("route is: " + deleteEntryRoute.url)
       $.ajax({
               url: deleteEntryRoute.url({id: sendallproperty}),
               type: deleteEntryRoute.method,
               data: 'id=' + sendallproperty,
               success : function() {
                 sendallProperty.remove();
               }
       });
    };
    

    Also {id: sendallproperty} is a jQuery Object ..

    If you want to pass the id … You need to do this

    {id: sendallproperty.attr('id')}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table where each row has a button that triggers AJAX call.
I have a table which each row has some info and a delete button
I have a table, and each row has a button to add a new
I have a table that has Edit and Delete links in each row. I
I have an HTML table with various rows, each has a delete button with
I have a table with multiple rows. Each row has a check button. How
I have a table where each row has a description field as well as
I have a table where each row has 13 TD elements. I want to
I have a table column where each row has one of three states, and
I have a table with many rows and each row has select lists. Something

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.