This commit is contained in:
Skylar Grant 2024-09-09 13:11:53 -04:00
parent e605be20f1
commit 2a5a0e041c
1 changed files with 5 additions and 2 deletions

View File

@ -12,8 +12,11 @@
<script> <script>
document.getElementById('testPrintBtn').addEventListener('click', () => { document.getElementById('testPrintBtn').addEventListener('click', () => {
fetch('/test-print', { method: 'POST' }) fetch('/test-print', { method: 'POST' })
.then(response => response.json()) .then(response => response.blob())
.then(data => alert(data.message)) .then(blob => {
const url = URL.createObjectURL(blob);
window.open(url);
})
.catch(error => alert('Error: ' + error)); .catch(error => alert('Error: ' + error));
}); });
</script> </script>