we can pass code from php to js

This commit is contained in:
lenovo
2022-10-31 10:21:24 +01:00
parent fe6810f159
commit 25be1d2a99
6 changed files with 59 additions and 155 deletions

View File

@@ -1,9 +1,12 @@
function mp_init_map() {
var locations = [
{lat: 38.8833, lng: -77.0167},
{lat: 39.8833, lng: -76.0167},
];
var map = new google.maps.Map(
/*
* following variable are created by mp_locations.php
* - let locations
* - let icon_url
*/
let map = new google.maps.Map(
document.getElementById("ljdp_map"),
{
zoom: 5,
@@ -11,11 +14,9 @@ function mp_init_map() {
center: locations[0],
}
);
var marker, icon;
// icon = "/wp-content/plugins/map_prof/marker.png";
let marker, icon;
icon = {
//url: document.location.href + "marker.png",
url: "/wp-content/plugins/map_prof/marker.png",
url: icon_url,
scaledSize: new google.maps.Size(35, 50)
};
for (loc of locations) {