Search Results

Search found 1 results on 1 pages for 'user1760663'.

Page 1/1 | 1 

  • How can I delete a row in the view only if the AJAX call & db deletion was successful?

    - by user1760663
    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 });

    Read the article

1