passing variables to map function : I'm trying to send a few longitude and latitude variables to a function that will then generate a google map.

Starting with a datatable that retrieves various information stored in a database, I'm using data-attributes to store the lng and lat for each record.  When a record is selected, a modal opens and the map is displayed.

I was able to get the map to display with default lng and lat points.  But now I need to create a new map every time a record is selected.

Starting with the onclick event that triggers the modal to open (shortened as much as possible):

    $('#example1').on('click', 'tr > td > a.actionMatch', function(e) 
    {
      e.preventDefault();
      
      var actimpbill = $(this).attr('data-actimpbill');	// random record info
      var actramplat = $(this).attr('data-actramplat'); // first lat
      var actramplng = $(this).attr('data-actramplng'); // first lng
      var actdellat = $(this).attr('data-actdellat'); // second lat
      var actdellng = $(this).attr('data-actdellng'); // second lng

      // my map was opening in a grey box. this next piece of code fixed that
      $("#actionMatchbackModal").on("shown.bs.modal", function () {
        google.maps.event.trigger(map, "resize");
      });

      initMap(actramplat, actramplng, actdellat, actdellng); // my attempt to call a function and the variables to it

      $('#actionMatchbackModal').modal('show'); // show the modal
    });

Here is the function that sets the map. This is located outside of the initial onclick event that opens the modal (I'm not sure if that's a problem).  This is where I'm trying to pass the variables that I created inside the onclick event:

    function initMap(dellat, dellng, reclat, reclng)
    {
      // map options
      var options = {
        zoom: 8,
        center: {dellat, dellng}
      }

      // new map
      var map = new google.maps.Map(document.getElementById('map'), options);
      
      // add marker
      var marker = new google.maps.Marker({
        position:{reclat, reclng},
        map: map
      });
    }

I am probably butchering the function call.  The function once housed the default lat and lng numbers and I was able to properly generate a map.

Please help me fix this error, and thank you in advance.

    