Click here to Skip to main content
16,015,218 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am using Praytimes JS source(http://praytimes.org/code/v2/js/PrayTimes.js) to display Muslim prayer times but for each location I have to manually add latitude & longitude of that location.

how can I get latitude & longitude and time zone (example: +4) values using API key or to add places in so just to type place name to get prayer time for that place, so
I want to know 1- how do I add cities manually 2- how to link the program to API places for below codes:
JavaScript
<script type="text/javascript">
prayTimes.setMethod('MWL'); 
var date = new Date(); // today
var times = prayTimes.getTimes(date, [23.022505, 72.5713621]);
var list = ['Fajr', 'Sunrise', 'Dhuhr', 'Asr', 'Maghrib', 'Isha', 'Midnight'];

var html = '<table id="timetable">';
html += '<tr><th colspan="2">'+ date.toLocaleDateString()+ '</th></tr>';
for(var i in list) {
    html += '<tr><td>'+ list[i]+ '</td>';
    html += '<td>'+ times[list[i].toLowerCase()]+ '</td></tr>';
}
html += '</table>';
document.getElementById('table').innerHTML = html;


What I have tried:

<select id="cities" size="1" style="font-size: 12px;" onchange="getValues()">
<option value="52.379189:4.899431:+2" selected="selected">Amsterdam</option>
<option value="33.45:-112.06:-2">Phoenix</option>
<option value="40.748817:-73.985428:+4">New York</option>

</select>
Posted
Updated 10-May-19 23:26pm

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900