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

184
Vistas
Action returns Status Code 204 but, AJAX success function doesn't execute

My controller is correctly returning new HttpStatusCodeResult(204)(checked using debugging), but the success function is not triggered. I just want to reset a text field after I've submitted something.

Ajax:

$(document).ready(function () {
        $("#offersubmit").click(function (e) {
            $.validator.unobtrusive.parse($('offerForm'));
            if ($(this).valid()) {
                var valdata = $("#offerForm").serialize();
                $.ajax({
                    url: "/Product/MakeOffer",
                    type: "POST",
                    dataType: 'json',
                    contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
                    data: valdata,
                    success: $(document).ready(function () {
                        alert("AAA");
                        $('#offerText').val('');
                    })
                })
            }
        });
    });

Also tried with alert() and it didn't show anything. Any help would be appreciated

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You need to remove the $(document).ready(.. code

success: $(document).ready(function () {
    alert("AAA");
    $('#offerText').val('');
})

should be

success: function(data) {
    alert("AAA");
    $('#offerText').val('');
}
about 4 years ago · Juan Pablo Isaza 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