I’m having trouble displaying the contents of my table onto my html page,I’ve connected my database to the application.
this is my html code of the page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Issue Hardware</title>
<link rel="stylesheet" href="/css/styles.css">
</head>
<body>
<div>
<h1>Issue Hardware</h1>
<form id="issue-hardware-form">
<input type="number" id="hardware-id" placeholder="Hardware ID" required>
<button type="submit">Issue Hardware</button>
</form>
</div>
<script>
document.getElementById('issue-hardware-form').addEventListener('submit', function(event) {
event.preventDefault();
const id = document.getElementById('hardware-id').value;
fetch(`/hardware/issue/${id}`, {
method: 'POST'
})
.then(response => response.json())
.then(data => {
alert('Hardware issued successfully');
document.getElementById('hardware-id').value = '';
});
});
</script>
</body>
</html>
I’m getting this error
{"timestamp":"2024-06-24T15:47:49.005+00:00","status":405,"error":"Method Not Allowed","path":"/static/css/view-available-hardware.html"}
New contributor
Riya Singh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.