Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

182
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda