M
M
Michael2017-08-20 19:53:05
Django
Michael, 2017-08-20 19:53:05

How to make ajax post with axios Vue.js?

Doing get requests via axios works. How to make a POST request given csrf_token django?
I try like this.

ser: function(){
            axios.post("{% url 'url' %}",{
                headers: {
                    'X-Requested-With': 'XMLHttpRequest'
                },
                params: {
                    text: this.note_t
                }}).then((response) => {
                        this.load = response.data
                }).catch(function (error) {
                        this.selected = error;
                    });
        }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question