I'm having an issue sending a request to the controller, and I keep receiving a 500 error in the console. Can someone help me identify what could be going wrong here?
Thank you in advance!
Here is the JavaScript code I am working with:
$('.delete_btn').on('click', function () {
$.get("/List/Delete", { param: $(this).data('id') }, function (data) {
$('#modal_window').replaceWith('<div id="modal_window">' + data + '</div>');
$('#modal_window').show();
});
});
});
This is the controller code that is causing the problem:
//DELETE ITEM
public ActionResult Delete(int id)
{
H_Table item = db_connection.H_Table.Find(id);
db_connection.H_Table.Remove(item);
db_connection.SaveChanges();
return RedirectToAction("Index");
}
Here is a screenshot for reference: