transcripts-api / index.html
shyameati's picture
Validates ticker
3d04e63
<!DOCTYPE html>
<html>
<head>
<title>Ticker Checker</title>
<style>
body { font-family: Arial; margin: 40px; }
input { padding: 8px; width: 200px; }
button { padding: 8px 12px; }
#result { margin-top: 20px; font-size: 18px; }
</style>
</head>
<body>
<h2>Check if a Ticker Exists</h2>
<input id="tickerInput" type="text" placeholder="Enter ticker (e.g., AAPL)">
<button onclick="checkTicker()">Check</button>
<div id="result"></div>
<script>
async function checkTicker() {
const ticker = document.getElementById("tickerInput").value.trim().toUpperCase();
const resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // clear previous result
if (!ticker) {
resultDiv.innerHTML = `<span style="color: red;">Please enter a ticker.</span>`;
return;
}
try {
const response = await fetch(`/check/${ticker}`);
const data = await response.json();
if (data.exists) {
resultDiv.innerHTML = `<span style="color: green;">✔ ${data.message}</span>`;
} else {
resultDiv.innerHTML = `<span style="color: red;">✘ ${data.message}</span>`;
}
} catch (err) {
resultDiv.innerHTML = `<span style="color: red;">Error connecting to server.</span>`;
console.error("Network error:", err);
}
}
</script>
</body>
</html>