I have been having difficulty accessing the variables populated within an eventlistener which is used to obtain the results from a php query. I tried a number of different ideas but I have been unsuccessful. Any help would be appreciated
{
var longnew = -64.1;
var latnew = 44.52;
var trigger = 10;
var longs = 0;
var lats = 0;
query.addEventListener("submit", (event) =>{})
onsubmit = (event) => {
let long = "<?php echo"$long"?>";
let lat = "<?php echo"$lat"?>";
longs = parseFloat(long);
lats = parseFloat(lat);
trigger = 1;
if (trigger == 1){ //check variables
alert('Updated Extent:'+ longs + ', ' + lats + ', ' + trigger); // this reports the old search values check order of php sqlite query
}
}
if(trigger == 1) { //check to see if trigger isbeing read
alert('Updated Extent:'+ longs + ', ' + lats + ', ' + trigger); // this reports the old search values check order of php sqlite query
longnew = longs;
latnew = lats;
}
alert('Default or Updated Extent (*new): '+longnew + ', ' +latnew + ', ' +trigger);
}
I assumed by declaring the variables longs and lats at the start of the block that they could be populated and accessible. I also tried declaring a function but it also did not work.