Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

tarang19's avatar

Vue + axios post data get error formData is not a constructor

Code

methods:{
    onSubmit(){
      this.isSubmitted = true;
      this.loading = true;
      const formData = new formData();
      formData.append( 'living', this.living );
      formData.append( 'prefix', this.prefix);
      formData.append( 'first_name', this.first_name );
      formData.append( 'surname', this.surname );
      formData.append( 'suffix', this.suffix );
      formData.append( 'gender', this.gender );
      formData.append( 'birthDate', this.birthDate );
      formData.append( 'placeOfBirth', this.placeOfBirth );
      formData.append( 'additionalInfo', this.additionalInfo );

      console.log(formData);
      // this.$axios.$post( '/family', formData , {timeout: 120000 })
      //     .then(response => {
      //
      //     })

    }
  }

Any one know what is error

0 likes
1 reply
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

FormData is with capital f i think

const formData = new FormData();

Please or to participate in this conversation.