Posted on 19/11/2018 11:56:55
I solved the issue creating a web service about stores location, getting the data, making an Ajax call, and inserting the data into a div.
Attached is the image with the result, and this is the code of the ajax call:
function () {
var options = {};
options.url = "/api/location";
options.type = "GET";
options.dataType = "json";
options.async = false;
options.success = function (data) {
data.forEach(function (element) {
//$("#result").append("<h3>" + element + "</h3>");
console.log(element);
var location = $.parseJSON(element["location"]);
console.log(location);
//insertar valores en el mapa
var rows = "<div class='grid__col-md-3 js-current' data-lat='"+location['Lat']+"'data-lng='"+location['Lng']+"' data-icon data-title='"+element['name']+"'>" +
"<div class='dynamicweb-map__location-item'>"+
"<div class='dynamicweb-map__location-name js-location-search-item'>"+element['name']+"</div>"+
"<div class='dynamicweb-map__location-info'>"+
"<div class='js-location-search-item'>"+element['address']+"</div>"+
"<div class='js-location-search-item'>"+element['city']+"</div>"+
"<div class='js-location-search-item'>"+element['country']+"</div>"+
"</div>"+
"</div>";
$('#Maps-1685-list').append(rows);
});
}