3

How can I remove this error and how can I retrieve the data that I have passed via POST Request in Vue.js

This is my app.js, focus only on the red box.

enter image description here

Added this code to enable csrf_token.

enter image description here

This is the Route that what I'm trying to get a response

enter image description here

This is my Controller

enter image description here

And this is the error what I have encountered.

enter image description here

I want to know what is missing or wrong in my codes. I need your help.

1
  • 2
    Greetings! Please refrain from uploading code as image. Instead, write it directly in the question and style it properly! Commented Mar 23, 2017 at 11:54

1 Answer 1

2

You receive a MethodNotAllowedException because you defined a GET route but need a POST one.

Try to use

Route::post('page-send-message', 'MainController@send');

instead of

Route::get('page-send-message', 'MainController@send');

Anyway, using the axios library is recommended instead of a Vue post request. For more information look into the bootstrap.js of laravel

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.