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

398
Vistas
Why does AJAX success function doesn't work?

I don't know why that success doesn't work. I even saw later someone having same code and it worked.

function doButtonUpdate(buttonNumber) {
    $.ajax({
        dataType: "json",
        method: "POST",
        url: '/Button/ShowOneButton',
        data: {
            "buttonNumber":buttonNumber
        },
        
        success: function (data) {
            console.log(data);
            $("#" + buttonNumber).html(data);
        }
    })
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

In the dataType parameter you specify "json", which means this is the type of data you are expecting to receive from the server.

But since you are directly inserting received data into the HTML, I suspect you are not receiving a valid json response (maybe HTML or just plain text?). Hence the success callback is not executed. Try leaving out this parameter, which should then fall back to an "intelligent guess" for the received data type.

https://api.jquery.com/jquery.ajax/

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