我有一个使用 OData 和 Knockout Js 的应用程序。在我的应用程序中,我使用 POST、GET 和 DELETE HTTP 动词,当我托管我的应用程序时,GET 和 POST 不会引发任何错误,但 DELETE 会引发错误,不知道如何修复它。
以下是我使用 DELETE 的地方
self.remove = function (canadiancrude) {
var conf = confirm("Are you sure you want to delete this record?");
if (conf == true) {
$.ajax({
url: '/odata/Canadiancrudes(' + canadiancrude.Id + ')',
type: 'DELETE',
contentType: 'application/json',
dataType: 'json'
});
}
}
错误是
405 - HTTP verb used to access this page is not allowed.
The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.
"NetworkError: 405 Method Not Allowed
我如何解决它