I am using this jquery to populate a select element with options:
$("#ticket_customer").change(function() {
$.ajax({
url: "?getContactList=2&customer=" + $(this).val(),
async: true,
success: function(data) {
var sel = $("#ticket_contact");
sel.empty();
for (var i=0; i<data.length; i++) {
sel.append('<option value="' + data[i].sequence + '">' + data[i].forename + '</option>');
}
//$("#ticket_contact").html(data);
GetCustomerDetails();
}
});
});
the request to the URL is returning data in the following format:
[{"sequence":"465","forename":"first1","surname":"second1","email":"[email protected]"},{"sequence":"465","forename":"first2","surname":"second2","email":"[email protected]"}]
but its not populating the element