JSON format for jQuery UI Autocomplete

前端 未结 6 1162
青春惊慌失措
青春惊慌失措 2021-02-19 05:20

The documentation for jQuery UI Autocomplete states that the source property can be set to a URL that returns the suggested items in JSON format. However, it doesn

6条回答
  •  旧时难觅i
    2021-02-19 05:41

    I do a call to a Java Spring controller that simply returns the information below (in JSOn format). I build it with JSTL. But I don't know what kind of backend you use. But in Allmost every language you can simple output some JSON.

    Example:

    {
      "results": [{
          "id": " Canned",
          "name": " Canned"
        }, {
          "id": 64,
          "name": "Added Sulphites"
        },
        {
          "id": 3,
          "name": "age"
        }, {
          "id": "age",
          "name": "age"
        }, {
          "id": 59,
          "name": "age group"
        },
        {
          "id": "Allergen",
          "name": "Allergen"
        }, {
          "id": 85,
          "name": "Anchovies"
        }
      ]
    }
    

    I dislike autocomplete. maybe you found a better solution in flexbox: http://flexbox.codeplex.com/

提交回复
热议问题