How can I access a value returned via AJAX in jQuery?

How can I access a value returned via AJAX in jQuery?

I need to select values from some html select elements based on what is passed back from an AJAX call. The data is being retrieved, but I can't seem to access the data so as to use it to set the html select elements to the appropriate value.

This is the html that describes the html selects that need to be manipulated:

  1.     <div class="row">
            <div class="col-md-6">
                <div class="containerforproact">
                    <div>
                        <select id="dayofmonthselect">
                            @foreach (String day in daysOfMonth)
                            {
                                <option id="selItem_@(day) value="day">@day</option>
                            }
                        </select>
                        <label> of each month</label>
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="containerforproact">
                    <div>
                        <select id="ordinalselect">
                            @foreach (String ord in ordinalWeeksOfMonth)
                            {
                                <option id="selItem_@(ord) value=" ord">@ord</option>
                            }
                        </select>
                        <select id="dayofweekselect">
                            @foreach (String dow in daysOfWeek)
                            {
                                <option id="selItem_@(dow) value=" dow">@dow</option>
                            }
                        </select>
                        <label> of each</label>
                        <select id="weekormonthselect">
                            @foreach (String pf in patternFrequency)
                            {
                                if (pf == "Month")
                                {
                                    <option id="selItem_@(pf)" value="@pf" selected="selected">@pf</option>
                                }
                                else
                                {
                                    <option id="selItem_@(pf) value=" pf">@pf</option>
                                }
                            }
                        </select>
                    </div>
                </div>
            </div>
        </div>
...and here is the jQuery in question:

  1.     $.ajax({
                type: 'GET',
                url: '@Url.Action("GetUnitReportPairGenerateVals", "UnitReportPairGenerateVals")',
                data: { unit: unitval, report: rptval },
                contentType: 'application/json', //<= this is paired with stringify above; if comment out one, comment out both
                cache: false,
                success: function (returneddata) {
                    populategeneratevals(returneddata);
                },
                error: function () {
                    alert(returneddata.error.stringify);
                }
            });
        
        function populategeneratevals(generatedata) {
            // first, clear them all, if they had been set to something else
            $("#dayofmonthselect").val('1st');
            $("#ordinalselect").val('First');
            $("#dayofweekselect").val('Monday');
            $("#weekormonthselect").val('Month');
        
            // Now set those for which there are values
            //$("#dayofmonthselect").val(generatedata[0]); // doesn't work
            //$("#dayofmonthselect").val(generatedata.DayOfMonth); // doesn't work
            //$("#dayofmonthselect").val(generateddata.generatevals.DayOfMonth); - also doesn't work
            $("#ordinalselect").val(generatedata[1]);
            $("#dayofweekselect").val(generatedata[2]);
            $("#weekormonthselect").val(generatedata[3]);
        }
The second block of code in populategeneratevals() has no effect. I tried three different ways of accessing the "generatedata" data, but none of them changes the selected value of the "dayofmonthselect" element to what I want it to be - it DOES change it from a pre-selected value to nothing, though (changes from "1st" to nothing).

As mentioned, there *is* data; I can see this when stepping through it in ChromeDevTools:



So you can see "DayOfMonth" does have a value (5) in the case I'm testing. How can I extract the value that is there and use it to set the html-select val?