really strange one this.
I'm calling an AJAX call which returns an array of items using JSON (should be 5).
In the success function I console.log the response which shows me the array which has 5 items.
(5) [{…}, {…}, {…}, {…}, {…}]
    0: {id: "9232eef2-f66b-4a63-94dd-448271e9d4d0", title: "Dr"}
    1: {id: "3d27249e-d825-4e51-8032-0ffbe8ec839d", title: "Miss"}
    2: {id: "01d4f5c1-f19f-4390-9e01-7cd4cd501d07", title: "Mr"}
    3: {id: "20b9bb71-fa48-4597-ab91-0028e7cb123f", title: "Mrs"}
    4: {id: "89029583-6549-45a3-93fe-6ec32a73381e", title: "Ms"}
    length: 5
When I perform a loop I get the following results for title:
11:50:24.320 stage-1.php:241 Dr
11:50:24.320 stage-1.php:241 Miss
11:50:24.320 stage-1.php:241 Mr
11:50:24.320 stage-1.php:241 Mrs
11:50:24.320 stage-1.php:241 Ms
11:50:24.320 stage-1.php:241 undefined
So I console log the k
11:52:10.685 stage-1.php:241 0
11:52:10.685 stage-1.php:241 1
11:52:10.685 stage-1.php:241 2
11:52:10.685 stage-1.php:241 3
11:52:10.686 stage-1.php:241 4
11:52:10.686 stage-1.php:241 clean
My code is this:
$.ajax({
    type: "GET",
    url: "/assets/core/php/ajaxCalls/optionFields/getData-v2.php",
    dataType: "JSON",
    data: {
       optionFieldTypeID: "bb5ac90b-22c0-438d-8b75-d2cb23bb6df3"
    },
    success: function (response) {
        console.log(response);
        for (var k in response) {
             console.log(response[k]["title"]);
             console.log(k);
         }
    }
  });
I guess I'm doing something really obviously wrong but can't see it - any ideas?
 
    