i want to send data that i get it from controller to javascript file that exist in public/js/maps.js how can i do this can any one help
my code Controller :
public function index()
{
$userIp = "45.153.242.129";
$locationData = \Location::get($userIp);
return view('maps.index',[
'location' => $locationData
]);
}
view page:
<div id="world-map"></div>
maps.js
var handleVectorMap = function() {
"use strict";
if ($('#world-map').length !== 0) {
$('#world-map').vectorMap({
map: 'world_mill',
scaleColors: [COLOR_GREY_DARKER, COLOR_GREY_LIGHTER],
normalizeFunction: 'polynomial',
hoverOpacity: 0.5,
hoverColor: false,
zoomOnScroll: true,
markerStyle: {
initial: {
fill: COLOR_RED,
stroke: 'transparent',
r: 3
}
},
regionStyle: {
initial: {
fill: COLOR_DARK_LIGHTER,
"fill-opacity": 1,
stroke: 'none',
"stroke-width": 0.4,
"stroke-opacity": 1
},
hover: {
"fill-opacity": 0.8
},
selected: {
fill: 'yellow'
},
selectedHover: { }
},
backgroundColor: 'transparent',
markers: [
{latLng: [41.90, 12.45], name: 'Vatican City'},
{latLng: [43.73, 7.41], name: 'Monaco'},
]
});
}
};
so i want to display data in markers that exist in the javascript file.