JQuery Ajax is sending GET instead of POST

前端 未结 11 540
野性不改
野性不改 2020-12-03 00:20

The following code triggers a GET instead of a POST HTTP request.

function AddToDatabase() {
  this.url = \'./api/add\';
}

AddToDatabase.prototype.postData          


        
11条回答
  •  鱼传尺愫
    2020-12-03 00:52

    I had this issue, and it turned out to be a URL Rewrite module in IIS.

    I'm using ASP.NET MVC and WebAPI. I created rule to force lowercase URLs so social networks don't view the same URL as two different pages.

    For example:

    "http://url.com/View/Something/123GuidIdSomething"

    vs

    "http://url.com/view/something/123guididsomething"

    This however, was somehow messing with my ajax requests. I disabled the rule and the problem was resolved.

提交回复
热议问题