How to create prayer time table with location dropdown in JavaScript?

Hi,

I want to build a dynamic prayer time table for my website.

My goal is:

  • Show daily prayer times (Fajr, Dhuhr, Asr, Maghrib, Isha)

  • Add a dropdown for selecting city/location

  • Automatically update prayer times based on location

I found that some websites use APIs like PrayTimes or Aladhan.

I also created a simple version here: https://riyadhprayer.com

Can anyone guide me:

  • Should I use API or database?

  • Best way to implement location dropdown?

Thanks!

That is relatively simple. There are many useful articles about that.

Probably there are many articles about dropdowns that explain that too.

I am not sure what you are asking. That could be interpreted to mean use of a database for one of at least 2 possibilities.

  • pre-calculated prayer times
  • geographic coordinates (longitude and latitude)

If you mean geographic coordinates and have the data then a database would be good. You could even use a XML, JSON or CSV file.

I suggest researching and analyzing what libraries (APIs) exist. You will likely find something that works better than what you could create yourself. If there is something specific you need that none of the existing libraries provide then consider developing something yourself.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.