Level 3
If listNew is calculated before your map code, you can instead set addresses: listNew inside your fusion_run_map_fusion_map_5() function.
Hello In var list have Locations data. Want send this data in differ addresses array. Formatting json in other format like {infobox_content":"test", "latitude":"1","longitude":"2"}, and saving in listNew
<script type='text/javascript'>
jQuery(document).ready(function($) {
var list = {
Locations: [
{ "id": "1", "region": "USA1", "city": "NY1", "latitude": "12.871449", "longitude": "14.588341" },
{ "id": "2", "region": "USA2", "city": "NY2", "latitude": "12.871449", "longitude": "14.588341" },
{ "id": "3", "region": "USA3", "city": "NY3", "latitude": "12.871449", "longitude": "14.588341" }
]
};
// formatting json in other json format
var listNew = $.each(list.Locations, function(i, item) {
var item = '{infobox_content":"'+item.region+'<br/>'+item.city+'", "latitude":"'+item.latitude+'","longitude":"'+item.longitude+'"},';
});
console.log(listNew)
});
</script>
Now I want put this new format json data in addresses: [] How can I do this ?
<script type="text/javascript">
var map_fusion_map_5;
var markers = [];
var counter = 0;
function fusion_run_map_fusion_map_5() {
jQuery('#fusion_map_5').fusion_maps({
addresses: [
/// {infobox_content":"test", "latitude":"1","longitude":"2"},
],
animations: false,
infobox_background_color: '',
infobox_styling: 'default',
infobox_text_color: '',
map_style: 'custom',
map_type: 'roadmap',
marker_icon: '',
overlay_color: '',
overlay_color_hsl: {"hue":0,"sat":0,"lum":100},
pan_control: true,
show_address: false,
scale_control: true,
scrollwheel: true,
zoom: 7,
zoom_control: true,
});
}
google.maps.event.addDomListener(window, 'load', fusion_run_map_fusion_map_5);
</script>
<div id="fusion_map_5" style="height:350px;width:100%;"></div>
If listNew is calculated before your map code, you can instead set addresses: listNew inside your fusion_run_map_fusion_map_5() function.
Please or to participate in this conversation.