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

320
Views
AJAX: Can I POST an array/data from my GET request? (Flask)

question similar to AJAX/FLASK/JS: How to POST existing array into endpoint?, a new question I've posted but this doesn't specifically help with the new issue, sorry about that.

I am tying to POST an array, specifically the songFiles array, I have pushed with data from my AJAX GET request. Is there any way I can do this in the same call or any solution at all? Been trying to rack my brain, any help is welcomed, thanks :).

[My first question here, so I might be missing something]

    function getTableData(callback) {
    $.ajax({
        method: 'GET',
        url: '/api/getSong',
        dataType: 'json',
        success: function(data) {
            createMusicTable();
            
            let indexObj = Object.keys(data.song).length;
            
            for (var i = 0; i < indexObj; i++) {
                var song = data.song[i]
                var id = data.song[i].song_id;
                var fileName = data.song[i].song_file + '.mp3';
                
                songFiles.push(fileName);
                appendMusic(song, id);
                
                songTitle.id = "s" + i;
                console.log("td-ok");
                callback(songFiles);
            }
        }
    });
}

function callback(result){
    return fileNames 
}

EDIT FOR COMMENT:

success: function(data) {
           // CODE HERE BLAH BLAH 
                $.ajax({
                    method: 'POST',
                    url: '/someURL',
                    dataType: 'json',
                    success: function(data) {
                       
                    }
                });
            }
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Your question technically asks whether one can send a POST request from a GET request. Another possibility is that you want to send a POST request from the client-side once the GET request completed.

If you want to send it from your GET request, then you will need to modify the /api/getSong endpoint so that it will trigger a POST request from your server. If you do not want to wait for it, you can do it asynchronously. If you intend to wait for it, then you need to do it synchronously. You can build up your response as you like.

If you want to send the POST request from the client-side, then you will need to send it from the success callback.

over 4 years ago · Santiago Trujillo Report
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!