When you post code on the forums, you need to format it so it will display correctly.
You can highlight your code, then use the </> button in the editor window, or you can place three backticks ``` (top left key on US/UK keyboards) on a line above your code, and three on a line below your code. I find this approach easier, but unfortunately some European and other keyboards don’t have that character.
Where does the value of $location['lat'] come from? Is it coming from the JavaScript function callback? If it is, surely you’d do that in your JavaScript via the DOM, just by modifying the target of the href?
The only way I can see this being done in PHP is if your PHP code (running on the server) actually gets the location information, rather than the JavaScript function.
This is the store location that is stored in backend. i need current location lati and longi for mapping the route on google map from current location to store location