The following code snippet demonstrates closing one modal, opening another, and executing a parsing function upon button click:
$('#BtnUpCsv').on('click', function (e) {
$('#csvModal').modal('hide');
$('#pBarModal').modal('show');
Papa.parse(document.getElementById('csvinput').files[0], {...
While this code functions correctly in Firefox, it exhibits unexpected behavior in Chrome where the first modal fails to close immediately after the function is triggered. Instead, the parsing function seems to take precedence over the modal operations. The 'csvModal' eventually closes and the 'pBarModal' surfaces once the parse completes.
I attempted implementing a setTimeout
, but it interfered with the parsing process. Any insights on why this anomaly occurs?
UPDATE: complete code snippet below
Papa.parse(document.getElementById('csvinput').files[0], {
// Various parsing configurations
complete: function(results) {
// Parsing results handling and data processing logic
}
} );
} );