0
我試圖使用jQuery
和Ajax
向我的API發送POST
請求。Ajax POST請求問題Flask Restless
$.ajax({
url: '/api/Orders',
headers: {
contentType: "application/json"
},
type: "POST",
data: JSON.stringify({'description':'test'}),
});
當我使用postman
(Chrome擴展)的POST
請求是很好,一切都很正常。
如果我試圖用AJAX
響應使用上面的代碼是:
message:"Request must have "Content-Type: application/json" header"
我覺得很奇怪,因爲我設置contentType : "application/json"
。
不幸的是,這是行不通的。同樣的錯誤。感謝您的回答。 –