0

I have the following code inside a JS function:

$.post('script/route.php', {deliveryAddress: address}, function (data) {
    console.log(data);
    return "The distance to your location is "+data+ ".";
});

This function posts to a PHP file that calculates the distance between two addresses. The console shows the correct distance, but the string with data is not returned for some reason, the complete return seems to be ignored. How can this happen?

0 Answers0