Skip to content

Instantly share code, notes, and snippets.

@zenware
Created September 24, 2017 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zenware/67bf43ee0b27452ca6389fb414959c50 to your computer and use it in GitHub Desktop.
Save zenware/67bf43ee0b27452ca6389fb414959c50 to your computer and use it in GitHub Desktop.
gGLWER
<select id="insurance-provider"></select>
var url = "https://api.betterdoctor.com/2016-03-01/insurances?user_key=188abcacef63ce01200709dd0a48ffe3";
$.getJSON(url, function (response) {
populateSelect(response['data']);
});
var select = document.getElementById('insurance-provider');
function populateSelect(insurance_data) {
for (var i = 0; i<=insurance_data.length; i++){
var opt = document.createElement('option');
opt.value = insurance_data[i]['name'];
opt.innerHTML = insurance_data[i]['name'];
select.appendChild(opt);
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment