-1
        this.$http.post('../idea/comment'+idea_id, newResponse).then((response) => {
            //do something

            }, (response) => {

            });

        //get returned comment
        //update DOM
       },
     }
 });

All get request run fine but I keep getting this error when trying the Post request.

enter image description here

2
  • 1
    Since you have no replace in your code, you must not be showing us the correct block. Commented Dec 28, 2016 at 18:00
  • Try correcting the url to 'idea/comment/' + idea_id Commented Dec 28, 2016 at 18:06

1 Answer 1

1

Found what i was doing wrong, i didn't declare the CSRF token global correctly.

I did this

Vue.http.headers.common['X-CSRF-TOKEN'] = window.Laravel;

instead of

Vue.http.headers.common['X-CSRF-TOKEN'] = window.Laravel.csrfToken;

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.