Files
apimacro/resources/views/mylinkspao.blade.php

40 lines
1.3 KiB
PHP
Raw Normal View History

2024-05-20 22:57:08 +02:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Link Page</title>
</head>
<body>
<h1>Links</h1>
2024-05-20 23:22:38 +02:00
<form id="articleForm">
2024-05-20 23:38:06 +02:00
<label for="article_id">ID Articolo:</label>
2024-05-20 23:20:37 +02:00
<input type="text" id="article_id" name="id" />
2024-05-20 23:38:06 +02:00
<button type="button" data-action="search">Cerca Articolo</button>
<button type="button" data-action="checkPreOrder">Verifica Preordine</button>
2024-05-20 23:20:37 +02:00
</form>
2024-05-20 23:33:00 +02:00
<div id="result"></div>
2024-05-20 23:22:38 +02:00
<script>
2024-05-20 23:38:06 +02:00
const form = document.getElementById('articleForm');
const result = document.getElementById('result');
2024-05-20 23:22:38 +02:00
2024-05-20 23:38:06 +02:00
const buttons = form.querySelectorAll('button');
buttons.forEach(button => button.addEventListener('click', handleButtonClick));
2024-05-20 23:22:38 +02:00
2024-05-20 23:38:06 +02:00
function handleButtonClick(event) {
const action = event.target.dataset.action;
const id = form.querySelector('input[name="id"]').value;
2024-05-20 23:43:17 +02:00
let baseUrl = window.location.href;
baseUrl = baseUrl.slice(0, baseUrl.lastIndexOf('/'));
fetch(`${baseUrl}/handle-article-action-pao/${id}/${action}`)
2024-05-20 23:38:06 +02:00
.then(response => response.text())
.then(data => result.innerHTML = data);
}
2024-05-20 23:22:38 +02:00
</script>
2024-05-20 22:57:08 +02:00
</body>
2024-05-20 23:26:30 +02:00
</html>
2024-05-20 23:38:06 +02:00