JQuery Ajax is sending GET instead of POST

前端 未结 11 527
野性不改
野性不改 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 the same problem and found this question but answers didn't solve my problem. I eventually solve it by removing contentType field in ajax request.

    contentType: "application/json",
    

提交回复
热议问题