Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

133
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!