I want to remove selected row from the author table. So after selecting the row ajax should lead me to the actionMethod where the data by its given id is going to be removed from Database. After that I don't want to get anything back from the server since I will simply remove the corresponding row in the client side. So how to not return any data to succes callback from the controller?
<!--language: lang-Csharp-->
public ActionResult Delete (int id)
{
Author author = db.Authors.Find(id);
db.Authors.Remove(author);
db.SaveChanges();
return RedirectToAction("Index");
}
<!--language: lang-JS-->
if ($(this).parents().eq(0).next().find("tbody tr").hasClass("active")){
$(".author-delete").click(function(){
url = "/Admin/Delete/" + rowId
$.ajax({
type: 'POST',
url: url,
data: {id:rowId},
success: function myfunction(data) {
var $tr = $(this).parents().eq(0).next().find("tbody
tr").hasClass("active")
$tr.remove();
},
error: function (jqXHR, textStatus, errorThrown) {
console.log(textStatus, errorThrown);
}
});
})
}