0

根据标题,我有 2 个我正在尝试使用的 json 提要。第一个详细信息是哪个出发机场飞往哪个目的地机场,第二个我想用来查找飞往的机场的友好名称。我有一组信息页面。我想从这两个提要中动态输出每个页面上飞往的目的地列表。我不清楚如何将这些 push() 放入数组和排序等。非常感谢任何帮助。

第一次喂食

$.ajax({
  url: '/routesRouteInformation.action',
  async: false,
  dataType: 'json',
  success: function (response) {
  jsonRoutes = response;
  }
});

示例文件:

{
"LGW":[
 {"arvAirportCode":"EDI","multiSector":"M","endDate":"26-Oct-2013 00:00:00"},
 {"arvAirportCode":"NCL","multiSector":"D","endDate":"26-Oct-2013 00:00:00"},
 {"arvAirportCode":"SYY","multiSector":"M","endDate":"26-Oct-2013 00:00:00"},
 ...Etc

二次进料

$.ajax({
  url: '/airportsRouteInformation.action',
  async: false,
  dataType: 'json',
  success: function (response) {
  jsonInfo = response;
  }
});

示例文件:

[{"airportCode":"LGW","airportCountry":"UK","airportName":"London Gatwick", "longitude":"53.910297","latitude":"-8.818492"},
"airportCode":"BLL","airportCountry":"DK","airportName":"Billund","longitude":"55.740322","latitude":"9.151778"},
{"airportCode":"RNN","airportCountry":"DK","airportName":"Bornholm"},    {"airportCode":"BCN","airportCountry":"ES","airportName":"Barcelona","longitude":"41.2969","latitude":"2.07833"}
...Etc
4

2 回答 2

0

尝试

$.extend(object1, object2);
于 2013-02-27T08:57:17.110 回答
0

鉴于您的数据,我将首先检索机场信息,然后在路线中查找每个机场信息并将它们添加到其中。一些东西:

$.each(infos, function(index, info){
info.routes = routes[info.airportCode];
});
于 2013-02-27T09:07:37.673 回答