// Analyse Button Listener $('.button-analyse').click(function(event) { let buttonClass = $(this).data('class') let id = null if (buttonClass == 'test' ) { id = $('#select-test').children('option:selected').val() } else if (buttonClass == 'dataset' ) { id = $('#select-dataset').children('option:selected').val() } $.ajax({ url: `/admin/analysis/`, type: 'POST', data: JSON.stringify({'id': id, 'class': buttonClass}), contentType: 'application/json', success: function(response) { window.location.href = response }, error: function(response){ error_response(response) }, }) event.preventDefault() })