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

276
Views
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
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!