I'm trying to send the request to controller but the console returns 500 error. What is the problem here?
Thanks in advance!
JS CODE:
$('.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();
});
});
});
Controller:
//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");
}
SCREENSHOT: