-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
32 lines (28 loc) · 1.06 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$(document).ready(function() {
$('#sort-button').click(function() {
var selectedOptions = $('.sort-option:checked').map(function() {
return $(this).val();
}).get();
var descriptionValue = $('.description-input').val();
var genreValue = $('.genre-input').val();
$.ajax({
url: '/sort',
type: 'POST',
contentType: 'application/json;charset=UTF-8',
data: JSON.stringify({
sortTypes: selectedOptions,
descriptionValue: descriptionValue,
genreValue: genreValue
}),
success: function(response) {
var sortedData = response;
// Display the sorted data vertically
var output = '';
for (var i = 0; i < sortedData.length; i++) {
output += (i + 1) + '. ' + sortedData[i] + '<br>';
}
$('#sorted-data').html('<h2>Sorted Releases:</h2><p>' + output + '</p>');
}
});
});
});