Using two JSON files with JQuery [closed]

1

Good morning / afternoon / evening, I'm doing a college job trying to put 2 JSON files and compare a key, for example, the first file will have several addresses and a key relating them, that 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 of that table, and if it is another key, the next table, and so on, this code I'm using was copied from a place and made several modifications for me, I copied the original to have a base, follow 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 in advance

    
asked by anonymous 28.09.2016 / 01:32

0 answers