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

283
Vistas
How to Force a Function to Wait Until a bootbox Confirmation Result Arrives?

Following script reload the page before uploading all the files. I can manage to upload all the files if there is no duplicate. But not with bootbox confirmation box.

<script language="javascript">
        //This function is called on drop event to upload multiple files
        function file_uploads(files_obj, tocType) {
            if(files_obj != undefined) {
                var fileArr = [];
                for(i=0; i<files_obj.length; i++) {
                    var FName = files_obj[i].name.toUpperCase();
                    //validate_duplicate_file function make an ajax call to see if file already exist in Database
                    var IsDuplicate = validate_duplicate_file(files_obj[i], tocType);
                    if(IsDuplicate > 0){
                        //If file already exist it will ask for overwrite confirmation 
                        bootbox.confirm({
                            message: "<h3>Please Confirm...</h3><br> <p>Are you sure you want to overwrite <b>" + FName + " </b> ?</p>",
                            buttons: {
                                cancel: {label: 'No', className: 'btnBlack' },
                                confirm: {label: 'Yes', className: 'btnBlack'}
                                },
                            callback: function (result) {
                                if (result) {
                                    //If user allow to overwrite then upload the file to Database
                                    ajax_file_upload(files_obj[i])
                                }
                            }
                        });
                    }else{
                        //If not duplicate then upload the file to Database
                        ajax_file_upload(files_obj[i])
                    }
                }
                //Once all the files are uploaded reload the locations
                location.reload();
            }
        }
    </script>

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