Can you assist me in understanding how to retrieve values from an ajax function and then use them in a different function? Here is an example:
function getlanlon(){
$.ajax({
type: "GET",
url: "{{URL::to('/')}}/getlatlng",
//data: {value: 0},
//async: true,
success: function(result){
console.log(result)
}
}, "json");
};
Now, the challenge lies in calling the "result" from the above function into the following function. However, it seems to not be working as expected, with the console log consistently showing undefined.
map.on('load', function () {
latlon = getlanlon()
console.log(latlon)
}