Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

170
Vistas
How can I show a notification if the form data was submitted successfully?

How can I implement a notification after the successful submission of form data? Help me, please! There is such an idea (but it doesn't work. Even if sending fails, it displays 'Success' ):

<Form class="order_form" @submit.prevent=""> 
          <div>
            <Field v-model="fio" class="order_input" type="text" placeholder="Name" name="first_name" :rules="[isRequired, validateName]"/>
          </div>
            <ErrorMessage class="errMessage" name="first_name" />             
          <div>
            <Field v-model="phone" class="order_input" type="text" placeholder="Phone" name="phone" :rules="isRequired" />
          </div>
            <ErrorMessage class="errMessage" name="phone" />
         <button class="make_order" @click="postOrder">Send</button>
        </Form>
    <span>{{successMessage}}</span>

...

    data() {
    return {
        successMessage: '',
    }
  },

...

postOrder() {
  const orderDataStr = {fio: this.fio, phone: this.phone}
  axios.post(`${url}`, orderDataStr)
      .then((response) => {
        console.log(response.data);
        this.successMessage = 'Success!';
      })
      .catch((error) => {
        console.log(error);
      });
},
about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

You are assuming incorrectly that in your callback response will always be a successful when in reality you need to check the response for the status of the call you made And then determine if it was a success or a failure.

https://developer.mozilla.org/en-US/docs/Web/API/Response/ok

about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda