I am trying to return values within my dependant dropdown within laravel. The api/dropdown returns json, all working fine. However the values returned are not populated in my dropdown, rather they are displaying [object Object] instead.
Am I missing something?
$(document).ready(function($){
$('#firstselect').change(function(){
$.get("{{ url('api/dropdown')}}", { option: $(this).val() },
function(data) {
$.each(data, function(key, value) {
$('#secondselect')
.append($("<option></option>")
.attr("value",key)
.text(value));
});
});
});
});
api/dropdown