-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ddd0c24
commit eeaa2f5
Showing
1 changed file
with
22 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,28 @@ | ||
<script> | ||
$(document).ready(function () { | ||
// Function to handle range input change | ||
$('#normal_heart_sound_mitral_valve_range').on('input', function () { | ||
// Get the current value of the range input | ||
var rangeValue = $(this).val(); | ||
// Function to handle range input change for different heart sounds | ||
var heartSoundIdentifiers = ["normal_heart", "split_first_heart", "split_second_heart", "third_heart", "fourth_heart"]; | ||
|
||
// Make an AJAX POST request | ||
$.ajax({ | ||
url: 'mitralVolumeChange/', // Replace with your backend endpoint | ||
method: 'POST', | ||
data: {'csrfmiddlewaretoken': '{{ csrf_token }}', identifier:'normal_heart', rangeValue: rangeValue}, // Send the range value as data | ||
success: function (response) { | ||
// Handle success response | ||
console.log('POST request successful:', response); | ||
}, | ||
error: function (error) { | ||
// Handle error response | ||
console.error('Error in POST request:', error); | ||
} | ||
}); | ||
heartSoundIdentifiers.forEach(function (identifier) { | ||
$('#' + identifier + '_sound_mitral_valve_range').on('input', function () { | ||
// Get the current value of the range input | ||
var rangeValue = $(this).val(); | ||
|
||
// Make an AJAX POST request | ||
$.ajax({ | ||
url: 'mitralVolumeChange/', // Replace with your backend endpoint | ||
method: 'POST', | ||
data: { 'csrfmiddlewaretoken': '{{ csrf_token }}', identifier: identifier, rangeValue: rangeValue }, // Send the range value as data | ||
success: function (response) { | ||
// Handle success response | ||
console.log('POST request successful for ' + identifier + ':', response); | ||
}, | ||
error: function (error) { | ||
// Handle error response | ||
console.error('Error in POST request for ' + identifier + ':', error); | ||
} | ||
}); | ||
}); | ||
}); | ||
}); | ||
</script> |