1
Good morning/afternoon/night, I’m doing a college job trying to put 2 JSON files and compare a key, for example, in the first file will have several addresses and a key relating them, this key I put as "key": 1, and in the second file will have a table, in which it will compare and if the key is the same, it will display some of the data in this table, and if it is another key, from the following table, and so on, this code I am using was copied from one place and made several modifications by me, copied the original to have a base, follows the code:
$(document).ready(function() {
var map;
var centerPos = new google.maps.LatLng(-23.2146027, -45.8854213);
var zoomLevel = 12;
var mapOptions = {
center: centerPos,
zoom: zoomLevel
}; //DEFININDO A POSICAO INICIAL DO MAPA
map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
$.getJSON("https://api.myjson.com/bins/2whwa", function(data) { //BUSCANDO OS DADOS NO MYJSON
$.each(data, function(i) {
var tipo = 'TURBIDEZ';
var image = 'https://raw.githubusercontent.com/VCarnaval/IHC/master/newProject/images/car_red.png';
marker = new google.maps.Marker({ //CRIANDO OS MARCADORES NO MAPA
position: new google.maps.LatLng(this.lat, this.long),
title: this.bairro + "\n" + tipo + "\nAmostras Realizadas: " + this.jan.turbidez[0] + "\nAmostras em conformidade com padrão: " + this.jan.turbidez[1],
map: map,
icon: image
});
})
});
});
Thank you since
I’m just seeing a JSON call in this code. What is the address of the other JSON and which attribute you want to compare?
– lfarroco