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

147
Vistas
How to update the data of a POST view that I have already updated with the same AJAX function?

We used AJAX to launch a POST request with a set of data. We noticed that a piece of data was being sent incorrectly. After fixing it, we sent the request again but the web where we display the data is not updated, despite having checked that the request sends the data correctly. Could someone tell me how can I fix it please?

This is my code:

    //ajax function to send graphs to backend
$(document).ready(async function(){
    await new Promise(r => setTimeout(r, 1500));
    var canvas_elements=document.getElementsByClassName("chartjs-render-monitor")
    if (canvas_elements.length==2) {
        $('#bar-chart').addClass(function(){
            const csrf_cookie=getCookie('csrftoken');
            $.ajax({
                url: "graphs/",
                type: "POST",
                data:{
                    type:$('#vot_type').val(),
                    graphs:graphs_images(),
                },
                beforeSend: function(xhr) {
                    xhr.setRequestHeader("X-CSRFToken", csrf_cookie)
                },
                failure: function(data){
                    console.log(error)
                }     
            }).done(function(response){
                console.log("Hecho")
            });
        });
    }
});

We checked the console to see if the data was sent correctly, and as we can see, it sends the type and url of the graphs. console

But when we check the web, it is not updated.

web not being updated

Thank you so much in advance!

about 4 years ago · Juan Pablo Isaza
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