0

This is my template:

<form class="form-inline editableImage" @submit.prevent="upload">
    ...
</form>

This is my script:

methods: {
    upload: function() {
        let data = new FormData();
        data.append('foo', 'bar');
        console.log('data', data);
    }
}

console.log shows:

data FormData {}
    __proto__: FormData

Why is data empty?

0

1 Answer 1

1

Actually, it's not empty. You can check your data by using get(key) method. console.log(data.get('foo')); should show you 'bar'

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.