I have a JSON file with about a million entry, and when I load it in javascript like this:
<script>
var $select = $('#country');
$.getJSON("helpers/countries.json", function (data) {
console.log(data.length);
for (var i = 0; i < data.length; i++) {
var value = data[i].name;
var $option = $("<option/>").attr("value", value).text(value);
$select.append($option);
}
});
</script>
It takes about 30 seconds to show the list of countries in the dropdown menu.
I have put the file in /public/helpers/countries.json
on a server running ruby on rails.
I don’t want to use online APIs, I’d rather use local json file.