Consider the following Javascript. The JSON object I'm parsing has an array on it called History. Each object in the History (resp[0].History) array has a UniqueID property. How do I get at that UniqueID property for each object in the array please?
// Retrieve individual licence information.
function loadLicenceDetails(uniqueID) {
document.body.style.cursor = 'wait';
$('#loadingLicenceDiv').modal('show');
$.ajax({
type: 'POST',
contentType: 'application/json; charset=utf-8',
url: '/JadeLicensingWebService/default.asmx/GetLicenceDetails',
dataType: 'json',
data: '{"licenceHolder":"' + $.cookie("companyName") + '","uniqueID":"' + uniqueID + '"}',
success: function (data) {
resp = $.parseJSON(data.d);
$('#inputLicenceName').val(resp[0].LicenceName);
$('#licenceKeyInput').val(resp[0].LicenceKey);
$('#selectProductType').val(resp[0].Product);
$('#selectDuration').val(resp[0].Duration);
$('#startDateInput').val(resp[0].StartDate);
$('#expiryDateInput').val(resp[0].ExpiryDate);
$('#orderedByInput').val(resp[0].OrderedBy);
// How do I get at the History.UniqueID ?
$('#notesInput').val(resp[0].Notes);
$('#licenceInfoHeader').html('<strong>#' + uniqueID + '</strong> - ' + resp[0].LicenceName);
resp
an array or isresp.History
?resp[0].History
suggests the former. Or isresp
an array with an embedded subarray in theHistory
property? – Barmar Sep 7 '12 at 2:32