Bank IFSC Code Checker
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
background-color: #f4f4f9;
color: #333;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
text-align: center;
width: 100%;
max-width: 500px;
}
header {
margin-bottom: 20px;
}
h1 {
font-size: 24px;
color: #4CAF50;
}
.form-container {
margin-bottom: 20px;
}
#ifscCode {
padding: 10px;
width: 80%;
font-size: 16px;
border: 2px solid #4CAF50;
border-radius: 4px;
margin-bottom: 10px;
}
button {
padding: 10px 20px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #45a049;
}
.result {
margin-top: 20px;
padding: 15px;
background-color: #f9f9f9;
border: 1px solid #ddd;
border-radius: 4px;
display: none;
}
footer {
margin-top: 20px;
font-size: 14px;
color: #777;
}
async function checkIFSC() {
const ifscCode = document.getElementById('ifscCode').value;
const resultDiv = document.getElementById('result');
if (!ifscCode || ifscCode.length !== 11) {
resultDiv.style.display = 'none';
alert('Please enter a valid IFSC code!');
return;
}
const url = `https://ifsc.razorpay.com/${ifscCode}`;
try {
const response = await fetch(url);
if (!response.ok) {
resultDiv.style.display = 'none';
alert('IFSC code not found or invalid!');
return;
}
const data = await response.json();
if (data.error) {
resultDiv.style.display = 'none';
alert('Error: ' + data.error.message);
return;
}
const bankDetails = `
Bank Details
Bank: ${data.BANK}
Branch: ${data.BRANCH}
City: ${data.CITY}
State: ${data.STATE}
Address: ${data.ADDRESS}
Contact: ${data.CONTACT}
`;
resultDiv.style.display = 'block';
resultDiv.innerHTML = bankDetails;
} catch (error) {
resultDiv.style.display = 'none';
alert('An error occurred while fetching data.');
}
}