0
Would you like to delete a record in a button click by Jquery, what’s the best way to do it ? The way I did it’s not working.
Action I want to call by Jquery
// POST: Pais/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public ActionResult DeleteConfirmed(int id)
{
Pais pais = db.Paises.Find(id);
pais.Delete();
return RedirectToAction("Index");
}
Jquery event where I want to call Action Deleteconfirmed
$('.btnExcluirSimPopover').on('click', function () {
if (handlePopover > 0) {
$.post("/Pais/DeleteConfirmed", { id: handlePopover }, function (data){
});
}
});
Are you making a mistake or something? can you report better?
– Rafael Augusto
@Rafaelaugusto, no error friend, just do not enter the action I’m giving the post.
– Nicola Bogar