I am using this Ajax code to delete an entry. The code runs fine on the local host, while it constantly requests credentials on a hosted server.

and in the windows

With all the interlocutors of the participants, I basically suspect now for two reasons.
1) Web hosting is a cheap snapshot and is not updated for application rights, despite several efforts (you need to contact server level support)
2) Probably, some authentication token is required for the message box, for example this
$(document).ready(function () { $('.js-delete').on('click', function () { var button = $(this); var buttonId = button.attr("data-id"); //var container = $(this).parent().siblings('#tablex').find('#hiddenTable').clone(); var box = bootbox.dialog({ show: false, message: "Are you sure you want to delete the Record?", title: "Delete Record?", buttons: { cancel: { label: "Cancel", className: "btn-default" }, ok: { label: "Delete", className: "confirm btn btn-danger", callback: function (result) { if (result) { $.ajax({ url: "/api/datax/delete/" + button.attr("data-id"), method: "Delete", success: function () { button.parents("tr").remove(); } }); } console.log('Button Pressed.'); } } } }); }); });
And in my controller, I handle this delete request as follows.
[Route("api/datax/delete/{id}")] public void Delete(int id) { var dataInDb = _context.Datax.SingleOrDefault(c => c.Id == id); if (dataInDb == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } _context.Datax.Remove(dataInDb); _context.SaveChanges(); }
Tough guy
source share