错误 405(方法不允许)Laravel 5
问题描述
我正在尝试使用 jQuery 执行 POST 请求,但我收到错误 405(不允许方法),我正在使用 Laravel 5
Im trying to do a POST request with jQuery but im getting a error 405 (Method Not Allowed), Im working with Laravel 5
这是我的代码:
jQuery
HTML
控制器
Jquery 错误是 http://localhost/laravel5.1/public/empresas/eliminar/5 405(方法不允许).
The Jquery error is http://localhost/laravel5.1/public/empresas/eliminar/5 405 (Method Not Allowed).
网址值为
而数据值为
如果我更改为 $.get
请求它工作正常,但我想做一个发布请求.
If i change to $.get
request it works fine, but i want to do a post request.
有人可以帮我吗?
谢谢.
编辑!!
路线
推荐答案
methodNotAllowed
异常表示您请求的 HTTP 方法不存在路由.
The methodNotAllowed
exception indicates that a route doesn't exist for the HTTP method you are requesting.
您的表单设置为发出 DELETE
请求,因此您的路由需要使用 Route::delete()
来接收.
Your form is set up to make a DELETE
request, so your route needs to use Route::delete()
to receive this.
这篇关于错误 405(方法不允许)Laravel 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!