[Answered ]-How to store list of database items in HTML?

2👍

✅

I would use ajax to load the json data and populate the select list any time I need.

It would look something like this:

JSON “users.json”

[{ user: "bob", age: 40 }]

jQuery:

$.get("users.json",function(data){
  $.each(data,function(i,v){
     $("<option/>").html(v.user).val(v.age).appendTo("select#usernames");
  });
});

Leave a comment