I am trying to append the values from jquery to select box .
The html side is shown below
<select class="form-control prod" name="SalesPerson" id="SalesPerson" required>
<!-- <option value="">Select Sales Person</option> -->
</select>
Code Snippet of Ajax is shown below
success: function(data){
console.log(data);
$.each(data, function(key, value) {
$('#SalesPerson').append("<option value='" + data.admin_id + "'>" + data.fname + "</option>");
});
}
});
When i do console.log(data);
I get this output below
[{"admin_id":"206","fname":"FLYJAC-1BR","lname":""},{"admin_id":"252","fname":"KAMAL","lname":"G"},{"admin_id":"253","fname":"WILLIAM","lname":"S"}]
But the data is not appending to the select box . Any help appreciated.