in the select that shows a list from an api in json
<select id="Select"></select>
He goes to the js
function getData(){
$.ajax({
type: "GET",
url: 'http://localhost:8000/api/api',
dataType: "json",
success: function(data){
$.each(data,function(key, registro) {
$("#Select").append('<option value='+registro.id+'>'+registro.primer_nombre+'</option>');
});
},
error: function(data) {
alert('error');
}
});
}
He shows me the values without problem but does not update automatically and does not show the last one created.
Additionally, I choose that value and sent it through post .