I have 2 variables: Latitude and Longitude: I want to insert it like this.
<img src = "https://maps.googleapis.com/maps/api/staticmap?center=" + latitude + "," + longitude + "&zoom=15&size=640x640&scale=2&key=example";
Here's my code:
<head>
<script type="text/javascript">
    function TestGeo() {
      if (navigator.geolocation) {
          navigator.geolocation.getCurrentPosition( TestMap, error, {maximumAge: 30000, timeout: 10000, enableHighAccuracy: false} );
      } else {
          alert("Sorry, but it looks like your browser does not support geolocation.");
            }
        function TestMap(position) {
            var latitude = position.coords.latitude;
            var longitude = position.coords.longitude;}
        </script>
        </head>
        <body onload="TestGeo();">
        <img src = "https://maps.googleapis.com/maps/api/staticmap?center=" + latitude + "," + longitude + "&zoom=15&size=640x640&scale=2&key=example";
        </body>
        </html>
 
    