diff --git a/index.html b/index.html index ce78602..7932fcc 100644 --- a/index.html +++ b/index.html @@ -20,7 +20,7 @@

A lightweight, configurable select box/text input plugin. Similar to Select2 and Selectize but without the jQuery dependency.

For all config options, visit the GitHub repo.

Text inputs

- + @@ -90,7 +90,7 @@ - +
@@ -103,7 +103,7 @@ - + @@ -140,7 +140,7 @@ - + @@ -218,15 +218,22 @@ }); var choices14 = new Choices('#choices-14').ajax(function(callback) { - fetch('https://restcountries.eu/rest/v1/all') - .then(function(response) { - response.json().then(function(data) { + var request = new XMLHttpRequest(); + request.open('get', 'https://restcountries.eu/rest/v1/all', true); + request.onreadystatechange = function() { + var status; + var data; + if (request.readyState == 4) { + status = request.status; + if (status == 200) { + data = JSON.parse(request.responseText); callback(data, 'alpha2Code', 'name'); - }); - }) - .catch(function(error) { - console.log(error); - }); + } else { + console.log(status); + } + } + } + request.send(); }); var choicesMultiple = new Choices('[data-choice]', {