Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
sivaprasath2004 committed Jun 15, 2024
1 parent 048571f commit c78e27d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 22 deletions.
8 changes: 0 additions & 8 deletions Existing_API_Collection/GlobalHolidayAPI/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ <h1>Holiday List For Countries</h1>
</header>
<main>
<div class="search-container">
<div>
<label for="country-input">Select Country:</label>
<select id="country-input">
<option value="IN">India</option>
Expand All @@ -32,15 +31,8 @@ <h1>Holiday List For Countries</h1>
<option value="JP">Japan</option>
<option value="LU">Luxembourg</option>
</select>
</div>
<div>
<label>Select Year: </label>
<select id="year-input">

</select>
<button id="search-button">Search Holidays</button>
</div>
</div>
<div id="holidays-list">
<!-- Holidays will be displayed here -->
</div>
Expand Down
20 changes: 7 additions & 13 deletions Existing_API_Collection/GlobalHolidayAPI/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,19 @@ document.addEventListener("DOMContentLoaded", () => {
const searchButton = document.getElementById("search-button");
const countryInput = document.getElementById("country-input");
const holidaysList = document.getElementById("holidays-list");
const Year_container=document.getElementById('year-input')

searchButton.addEventListener("click", () => {
const countryCode = countryInput.value;
const Year=Year_container.value
if (countryCode && Year) {
fetchHolidays(countryCode,Year);

if (countryCode) {
fetchHolidays(countryCode);
}
});
const year=new Date().getFullYear()
for(let i=year;i>=2010;i--){
const option=document.createElement('option')
option.setAttribute('value',i)
option.textContent='year: ' +i
Year_container.appendChild(option)
}
function fetchHolidays(countryCode,Year) {

function fetchHolidays(countryCode) {
//API KEY
const apiKey = 'akio9k5qVkY8dCwDGw657ZGC3M8LWOcY';
const apiUrl = `https://calendarific.com/api/v2/holidays?country=${countryCode}&year=${Year}&api_key=${apiKey}`;
const apiUrl = `https://calendarific.com/api/v2/holidays?country=${countryCode}&year=2023&api_key=${apiKey}`;

fetch(apiUrl)
.then(response => {
Expand Down
2 changes: 1 addition & 1 deletion Existing_API_Collection/GlobalHolidayAPI/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ label {
font-size: 18px;
}

#country-input ,#year-input{
#country-input {
padding: 10px;
margin: 10px 0;
border: 1px solid #ccc;
Expand Down

0 comments on commit c78e27d

Please sign in to comment.