I think you need to refresh the page the to see the update. From `<apex:actionFunction>` use `oncomplete` event to refresh the page as follows: <apex:actionFunction name="updateDistance" action="{!updateRec}" oncomplete = "window.top.location.reload();" rerender="mainMap" status="myStatus">