Forum

VUE, Axios - how to...
 
Notifications
Clear all

VUE, Axios - how to send form data in background (AJAX)

   RSS

0
Topic starter

example

1 Answer
0
Topic starter

form code

<script>
import axios from "axios";

export default {
    components: {axios},
    methods: {
        getFormData(){
            let myForm = document.getElementById('form');
            return new FormData(myForm);
        },
        formSend(){
            axios.post(this.formAction, this.getFormData());
        },

and button

   <button type="button" role="button" class="btn btn-primary align-content-end" @click="formSend">
                                        Send
                                    </button>

Odpowiedź

Author Name

Author Email

Your question *

 
Preview 0 Revisions Saved
Share: