Stack Exchange
Ajax return PUT ... 405 (Method Not Allowed)
web.php:
Route::put('contact', 'FormsController@send');
script.js:
    const sendForm = function () {
        action = 'contact';

        if (window.XMLHttpRequest) {
            xmlhttp = new XMLHttpRequest();
        } else {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }

        xmlhttp.onreadystatechange = function () {
            if (this.readyState == 4 && this.status == 200) {
                const getMessageSend = document.querySelector("#messageSend");
                getMessageSend.classList.add("message-send");
                getMessageSend.innerText = "Thank you for sending an email. You will receive an answer shortly.";
            } else {
                const getMessageSendError = document.querySelector("#messageSendError");
                getMessageSendError.classList.add("message-send");
                getMessageSendError.classList.add("message-send-error");
                getMessageSendError.innerText = "An error occurred and the email was not sent.";
            }
        }
        xmlhttp.open("PUT", action, true);
        xmlhttp.send();

    };

and my form:
{!! Form::open(['action'=>['FormsController@send'], 'method' => 'PUT', 'class' => 'form', 'novalidate' => 'novalidate', 'files' => true]) !!}

    ...

{!! Form::submit('Send', ['class' => 'submit-btn']); !!}
{!! Form::close() !!}

Laravel reurn error:
script.js:566 PUT http://subdomain.mypage.com/contact 405 (Method Not Allowed)

I have this same name FormsController@send, and name address contact. I added to header in index file:

but the error still occurs. I do not know what I'm doing wrong.
Edit:
more information with error:
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: multipart/form-data; boundary=---------------------------15304174751887
Content-Length: 147
Cookie: XSRF-TOKEN=eyJpdiI6Imk0RVE5NDB3eHBXaGQ0OUwyc0VXa3c9PSIsInZhbHVlIjoiV2xPYzl4VzN1bEFJdDFBZ0JiZ1Nhd2JYZTVzRW1WekdobVwvNjNpY24wVmtEVUJQbFV1K1Q4anBydXdOSEt5WWIiLCJtYWMiOiI5MzgwYmMzNDU0ZTAzY2NkNzNkNGEwNjk0NTYxNDk2ZjE5NjQzMTVjNGViOTQ5ZTNhZmI5N2I3NDQzNjM2OTY2In0%3D; hr_session=eyJpdiI6IlVLVU9WN0pEZlVJbUZOeFdIRWZ0cnc9PSIsInZhbHVlIjoiVzFEenJyc2x6d09TQjV0bWczc05LMlwvNHZDZ3hKSDdaZEpaeEFnVXc2d0NmZVpTeGY1NUJocWFzOStDN3h6OWIiLCJtYWMiOiIwYTJjYjZhMjcyMzk3MWVlOGUzMDYxOTM4ODFiNTc1Y2QzMWQ4ZWRhY2Y1ZTdiMjIyYTg4MTFhM2I2NGE0OTI2In0%3D
Connection: keep-alive


when you inspect html of the form do you see input:hidden with _method=put?

@SevaKalashnikov Change my post: I see <form method="POST" action="http://subdomain.mypage.com/contact" accept-charset="UTF-8" class="form" novalidate="novalidate" enctype="multipart/form-data"><input name="_method" type="hidden" value="PUT"><input name="_token" type="hidden" value="Yzszl9PJVQn3HVNMnhz94vMYGiLvGN7LdbXce0VY">

Try to replace xmlhttp.send(); for 
var formdata = new FormData();
formdata.append("_method", "put");
xmlhttp.send(formdata);


Still I have this same error. I edit my post, added more info

Have you checked the request via google console to verify the type and _method var is sent? @michal

You mean Google Chrome browser and console in this browser ?

No I check this in Firefox Developer Edition

So do you see the correct request type and _method var being sent? @michal
