title: google maps api findplace request not working properly
body: <p>I want to display on my webpage the location from a JSON that has displayed a pharmacy name. The point is that google maps API is a little bit over my power of knowledge. I did a find-place request into the google maps API, but the location that is displayed is the one from my current location.</p>
  <p><strong>Here is the part of the code that would interest you</strong></p>
  <pre><code>&lt;div id=&quot;map&quot;&gt;&lt;/div&gt;
  
    &lt;script src=&quot;./keys.js&quot;&gt;&lt;/script&gt;
    &lt;script&gt;
      let map;
      document.addEventListener(&quot;DOMContentLoaded&quot;, () =&gt; {
        let s = document.createElement(&quot;script&quot;);
        document.head.appendChild(s);
        s.addEventListener(&quot;load&quot;, () =&gt; 
        {
          console.log(&quot;script has loaded&quot;);
  
          x = navigator.geolocation;
  
          x.getCurrentPosition(success, failure)
  
          function success(position){
  
            var myLat = position.coords.latitude;
            var myLong = position.coords.longitude;
  
            var coords = new google.maps.LatLng(myLat,myLong);
        
            map = new google.maps.Map(document.getElementById(&quot;map&quot;), {
                center: coords,
                zoom: 16,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            });
  
            var marker = new google.maps.Marker({
                map: map,
                position: coords,
            })
          }
          
          function failure(){}          
          
        });
        s.src = `https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=&lt;%= &quot;#{@medicament['farmacies'].first['name']}&quot;%&gt;&amp;inputtype=textquery&amp;fields=formatted_address,name,rating,opening_hours,geometry&amp;key=**************`;
    
      });
    &lt;/script&gt;
  &lt;/div&gt;
  </code></pre>
  <p>where <code>&lt;%= &quot;#{@medicament['farmacies'].first['name']}&quot;%&gt;</code> represents the name of the pharmacy from the html erb file.</p>
  <p><strong>What I found strange is that if I inspect the page where the location is the <code>s.src</code> takes me to a JSON that has all the right address information for the pharmacy.</strong></p>
  <p>Here you can see an image with the response from the API:</p>
  <p><a href="https://i.stack.imgur.com/7lR9O.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7lR9O.png" alt="image" /></a></p>
  <p>What I want is to point to the address of that pharmacy on google map. Any tips&amp;tricks are very welcome!</p>