Error 405 (Method Not Allowed) 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

THis is my code:


<script type="text/javascript">
    $(document).ready(function () {
        $('.delete').click(function (e){
            var row = $(this).parents('tr');
            var id ='id');
            var form = $('#formDelete');
            var url = form.attr('action').replace(':USER_ID', id);
            var data = form.serialize();
            $.post(url, data, function (result){


{!! Form::open(['route' => ['companiesDelete', ':USER_ID'], 'method' =>'DELETE', 'id' => 'formDelete']) !!}

    {!!Form::close() !!}


public function delete($id, \Request $request){
        return $id;

The Jquery error is 405 (Method Not Allowed).

The url value is

and the data value is


If i change to $.get request it works fine, but i want to do a post request.

Anyone could help me?




Route::post('empresas/eliminar/{id}', ['as' => 'companiesDelete', 'uses' => 'CompaniesController@delete']);


The methodNotAllowed exception indicates that a route doesn't exist for the HTTP method you are requesting.

Your form is set up to make a DELETE request, so your route needs to use Route::delete() to receive this.

Route::delete('empresas/eliminar/{id}', [
        'as' => 'companiesDelete',
        'uses' => 'CompaniesController@delete'

Your routes.php file needs to be setup correctly.

What I am assuming your current setup is like:


or something. Define a route for the delete method instead.


Now if you are using a Route resource, the default route name to be used for the 'DELETE' method is .destroy. Define your delete logic in that function instead.


 ? Get jQuery post array values in laravel
 ? Laravel ajax 404 not found error
 ? Laravel unisharp file manager combine file and image manager
 ? Laravel unisharp file manager combine file and image manager
 ? Laravel unisharp file manager combine file and image manager
 ? laravel file manager doesn't show uploaded images
 ? Laravel 5 image resize
 ? TinyMCE Image Upload with Laravel, without File Manager
 ? Laravel file manager illegal offset type
 ? Laravel file manager illegal offset type