I have the following function that deletes a user from my database using a Web API the server side function returns a string to show whether the user was found and deleted or the user id was not found, it returns a "string" type,
following is the ajax function
function deleteuser() {
var id = $('#<%=txtDelete.ClientID %>').val();
$.ajax({
url: "<%=Page.ResolveUrl("/api/User/")%>" + id,
type: "DELETE",
contentType: "application/json;charset=utf-8",
dataType: "json",
success: function (response) {
alert(response);
getAllContacts();
},
error: function (x, e) {
alert(x.responseText);
alert(e.toString());
alert('fail');
getAllContacts();
}, async: true
});
the problem is that when I call the deleteuser() function, the alerted response returned is always null