ska-referee-test/ref-test/app/analysis/static/js/analysis.js

27 lines
740 B
JavaScript
Raw Normal View History

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