I can successfully do an ajax call to my webAPI like this:
Javascript:
$.ajax({
type: "GET",
url: "api/Breeze/DeleteMaterials",
cache: false,
data: { aa: 'aa', bb: 'bb' },
dataType: "json",
contentType: "application/json; charset=utf-8",
traditional: true,
success: () => { result.resolve(true); },
error: (error) => result.reject(error)
});
Web API:
[System.Web.Http.HttpGet]
public void DeleteMaterials(string aa, string bb)
{
// doing something here
}
It works pretty well. The webAPI is reached and the value parameters are present. Now I don't want to keep a 'GET' call because here I'm performing a delete server side, I need wether a 'DELETE' or 'POST'.
I know the 'DELETE' call is not possible because it only accepts 1 parameter and for my case I need to pass 2 parameters.
So I try to replace 'GET' by 'POST' in my previous code and the webAPI is never reached and I get the HTTP error 404: not found.
I already searched a lot in all SO suggestions but none of them gives me what I need.
Any idea?
Thanks.