自动完成 - 远程json源 - 多维度

时间:2017-09-13 13:40:55

标签: jquery json autocomplete

这是我的自动完成框的远程JSON文件源。

{
  "country": [{
    "name": "Spain",
    "city": [{
      "code": "BCN",
      "name": "Barcelona",
      "location": [{
        name": "Barcelona Downtown",
        "airportCode": "BCN"
      }, {
        "name": "The Barceloneta",
        "airportCode": "BCN"
      }]
    }]
  }, {
    "name": "Norway",
    "city": [{
      "code": "OSLALL",
      "name": "Oslo",
      "location": [{
        "name": "Oslo Downtown",
        "airportCode": "OSL"
      }, {
        "name": "Fornebu",
        "airportCode": "OSL"
      }, {
        "name": "Lysaker",
        "airportCode": "TRF"
      }]
    }]
  }, {
    "name": "France",
    "city": [{
      "code": "PARALL",
      "name": "Paris",
      "location": [{
        ", "name": "Paris Downtown",
        "airportCode": "ORY"
      }, {
        "name": "The Touquet-Paris-Plage",
        "airportCode": "ORY"
      }, {
        "name": "The Arcs",
        "airportCode": "ORY"
      }]
    }]
  }]
}

当在自动填充表单中选择项目时,我想将机场代码保存在隐藏字段中。请帮帮我。

如果你有更好的想法从这个Json读取数据并获得相同的功能,那就太好了。 谢谢!!

0 个答案:

没有答案