title: Load Google Maps option after AJAX call in PHP
body: <p>TL;DR: I have a MySQL table called company with 2 fields (lat, long) that I want to retrieve to load the address in Google Maps.
  So my function initMap(lat, long) in the file map.js needs those two arguments. </p>
  
  <p>How can I pass those values after the AJAX call to the JS function that loads the map?</p>
  
  <p>AJAX Function</p>
  
  <pre><code>function searchCompany() {
              $.ajax({
                  type: 'post',
                  url: 'ajax/search-company.php',
  
                  data: {
                      data:idComp
                  },
                  success: function (response) {
                      document.getElementById("company").innerHTML=response;
  // CALL INITMAP() HERE!
                      }
                  });
              }
  </code></pre>
  
  <p>Google Maps script tag</p>
  
  <pre><code>&lt;script async defer
  src="https://maps.googleapis.com/maps/api/js?key=MY_KEY&amp;callback=initMap"&gt;
  &lt;/script&gt;
  &lt;script src="js/map.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>Map.js</p>
  
  <pre><code>function initMap(lat, long) {
  
  var location= new google.maps.LatLng(lat, long);
  var mapEl= document.getElementById('map');
  var mapOpt= {
      center: location,
      zoom: 15,
      panControl: false,
      mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  var map = new google.maps.Map(mapEl, mapOpt);
  
  // Add marker
  var imgMarker= {
      url: 'img/marker.png',
      scaledSize: new google.maps.Size(50, 50)
  }
  var marker= new google.maps.Marker({
      position: location,
      map: map,
      icon: imgMarker
  });
  
  var contentString= '&lt;div class="info-window"&gt;'+
                        '&lt;h3&gt;Info&lt;/h3&gt;'+
                        '&lt;div class="info-content"&gt;'+
                        '&lt;p&gt;Text&lt;/p&gt;'+
                        '&lt;/div&gt;'+
                        '&lt;/div&gt;';
  
  var infoWindow = new google.maps.InfoWindow({
      content: contentString,
      maxWidth: 400
  });
  
  mark.addListener('click', function() {
      infoWindow.open(map, marker);
  });
  }
  </code></pre>