Bank IFSC Code Checker
body {
font-family: Arial, sans-serif;
background-color: #f9f9f9;
margin: 0;
padding: 0;
}
.container {
max-width: 600px;
margin: 0 auto;
padding: 20px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
background-color: #ffffff;
}
h1 {
text-align: center;
color: #4CAF50;
}
input[type="text"] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
background-color: #4CAF50;
color: #ffffff;
border: none;
padding: 10px 20px;
cursor: pointer;
border-radius: 4px;
width: 100%;
}
button:hover {
background-color: #45a049;
}
#result {
margin-top: 20px;
padding: 10px;
background-color: #f2f2f2;
border-radius: 4px;
display: none;
}
#result p {
margin: 0;
color: #333;
}
#result.success {
background-color: #d4edda;
border-color: #c3e6cb;
color: #155724;
}
#result.error {
background-color: #f8d7da;
border-color: #f5c6cb;
color: #721c24;
}
document.getElementById('checkButton').addEventListener('click', function () {
const ifscCode = document.getElementById('ifscInput').value;
if (ifscCode.trim() === '') {
alert('Please enter an IFSC code.');
return;
}
fetchIFSCDetails(ifscCode);
});
function fetchIFSCDetails(ifscCode) {
const apiUrl = 'https://ifsc.razorpay.com/';
fetch(apiUrl + ifscCode)
.then(response => response.json())
.then(data => {
displayResult(data);
})
.catch(error => {
displayError('An error occurred while fetching data. Please try again later.');
});
}
function displayResult(data) {
const resultDiv = document.getElementById('result');
const resultMessage = `
Bank Name: ${data.BANK}
Branch: ${data.BRANCH}
IFSC Code: ${data.IFSC}
Address: ${data.ADDRESS}
City: ${data.CITY}
State: ${data.STATE}
`;
resultDiv.innerHTML = resultMessage;
resultDiv.classList.add('success');
resultDiv.style.display = 'block';
}
function displayError(errorMessage) {
const resultDiv = document.getElementById('result');
resultDiv.innerText = errorMessage;
resultDiv.classList.add('error');
resultDiv.style.display = 'block';
}
0 Comments