[英]Failed to load resource: the server responded with a status of 405 ()
I'm having this error: 我遇到这个错误:
Failed to load resource: the server responded with a status of 405 () 加载资源失败:服务器响应状态为405()
How can I fix it? 我该如何解决? Here's my code: 这是我的代码:
views: 意见:
this.find('.deleteButton').unbind('click').on('click', function (e) {
e.preventDefault();
var $this = $(this);
$.ajax({
url: $this.data('url'),
method: 'DELETE',
success: function () {
location.reload();
}
routes: 路线:
Route::delete('/users/delete/{entity}', [
'as' => 'users.delete',
'middleware' => ['permission:delete-recruiters'],
'uses' => 'UsersController@delete'
]);
controllers: 控制器:
public function delete(User $entity)
{
$entity->delete();
}
Http status 405 is METHOD NOT ALLOWED, which might mean route you are trying to make request to is wrong. Http状态405为“方法不允许”,这可能意味着您试图向其发出请求的路由是错误的。 Check your $this.data('url'), most likely you are hitting different route. 检查您的$ this.data('url'),很可能是您选择了其他路线。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.