I am trying to put this data I get back from the server into a dropdown list but don't know how to do it since each object name starts with a random ID. This is what I am trying to do here:
$("#CampaignOpenActionSubscriber_campaign_id").change(function() {
var el = $(this);
$.ajax({
type: 'POST',
url: "Dropdownlist",
data: 'csrf_token=' + $('meta[name=csrf-token-value]').attr('content') +'&Selectedcampaign_id=' + el.val(),
success: function (response) {
var jsonResponse = $.parseJSON(response);
for(var i=0; i< jsonResponse.length; i++){
$("#selectCourse").append(
$('<option>').text(jsonResponse[i]).val(jsonResponse[i])
);
}
}
});
});
and this is what I get back from my JSON response... :
{288878: "FOO", 288881: "BAZZ", 288882: "YOLLO"}
How would I put this into a dropdown list?