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

179
Vistas
How do I stop javascript from posting twice when clicking off date field?

When a user clicks on a date field and enters a date, a post request is sent. But then when the user clicks somewhere off the field, the request sends a second time. How do I correct this? I tried focusout() but the problem persists.

$(".cInput").focusout(function(){
    var fieldName = this.name;
    var fieldValue = this.value;
    var cid = $('meta[name="cid"]').attr('content');
    var cnum = $('meta[name="cnum"]').attr('content');

    $.ajax({
        /* the route pointing to the post function */
        url: '/cUpdate',
        type: 'POST',
        /* send the csrf-token and the input to the controller */
        data: {_token: CSRF_TOKEN, moduleID: $("#moduleID").text(), checkName: fieldName, checkValue: fieldValue, cid: cid, cnum: cnum},
        dataType: 'JSON',
        /* remind that 'data' is the response of the AjaxController */
        success: function (data) { 
            window.history.replaceState({}, document.title, thisURL);
        }
    });
});
about 4 years ago · Santiago Trujillo
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