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

246
Vistas
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) {
                       
                    }
                });
            }
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

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.

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