I'm having a problem that I can't seem to figure out. I am making the following ajax call:
var dataArray = { table: "Products" };
$.ajax({
url: uri,
type: "POST",
cache: false,
datatype: "json",
data: dataArray
})
.done(function( msg ) {
alert( "Data Saved");
})
.fail(function () {
alert("error");
});
The issue I'm having is that this doesn't seem to be sending what I have in dataArray to my Web API controller, and keeps coming back with the following response:
{"Message":"No HTTP resource was found that matches the request URI 'http://myURI'.","MessageDetail":"No action was found on the controller 'MYController' that matches the request."}
The thing that is confusing me is that I can do a GET like this, and it returns data fine. Also if I just flatout append the querystring to the uri like
http://myURI?table=Products
then the POST works fine. I could do it this way, but I am pretty curious as to what I am doing wrong in the way I have above. Thanks!
This is what is in my controller. I'm just basically trying to verify I can get to it right now.
public void Post(string table)
{
string beingHit = "We did it!";
}