Click here to Skip to main content
15,919,749 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
When I try to call the function using the button click it is not working.


let text = "";

function myFunction() {
var latitute = <?php echo json_encode($latl); ?>;
var loni = <?php echo json_encode($long); ?>;
for (let i = 0; i < latitute.length; i++)
var x[i] = latitute[i]-loni[i];
text += latitute[i]-loni[i]; +"<br>";

document.getElementById("demo").innerHTML = text;

for (let i = 0; i < latitute.length; i++)
document.getElementById("demo").innerHTML = x[i];

What I have tried:

I have tried different methods and found that the function is not being executed when the button is being clicked.
Richard MacCutchan 16-Jul-22 4:05am    
Use the browser's console window to see exactly what happens when you click the button. The results will depend on the data being input to your function.

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