Finshing the main features

هذا الالتزام موجود في:
2025-08-19 02:20:06 +03:00
الأصل 227a985c2f
التزام 7e7a593bf6
4 ملفات معدلة مع 67 إضافات و11 حذوفات

21
app.js
عرض الملف

@@ -1,17 +1,20 @@
city.focus();
async function getTimes(city, countryCode){
console.log("Starting . . .")
document.getElementById("city").focus()
document.getElementById("show_city").innerText = city.toUpperCase() + " City "
document.getElementById("show_country").innerText = countryCode.toUpperCase() + " Country"
const response = await fetch(`http://api.aladhan.com/v1/timingsByCity?city=${city}&country=${countryCode}`)
const parsedResponse = await response.json();
const times = parsedResponse.data.timings
let container = ""
for (const time in times) {
console.log(time + " : " + times[time])
container += `<li>${time} : ${times[time]}</li>`
}
try {
const response = await fetch(`http://api.aladhan.com/v1/timingsByCity?city=${city}&country=${countryCode}`)
const parsedResponse = await response.json();
const times = parsedResponse.data.timings
let container = ""
for (const time in times) {
container += `<li><span class="cell">${time}</span><span class="cell">${times[time]}</span></li>`
}
document.getElementById("times_container").innerHTML = container
} catch(err){
console.log("Faild: " + err.message)
}
}
document.getElementById("getTimes").onclick = ()=> getTimes(city.value, code.value)