undefined iterating Ajax response Jquery

Viewed 31

I have this dataset returned to me by a method in C # aspx. However, whenever I want to iterate it, I get undefined the data arrives, but I can't access the properties.

this is the data set that reaches the response object:

    "[
  {
    "idFotografia": 96223,
    "Leyenda": "El Ministro de Salud, Oscar Ugarte, participó en el taller de comunicación de riesgo: \"La experiencia de la preparación contra la pandemia de influenza\". Foto: ANDINA / Rubén Grández.",
    "Descripcion": "",
    "Fecha": "2009-05-28T00:00:00",
    "Imagen": "000096223M.jpg",
    "Seccion": "Política",
    "Fotografo": "ANDINA/archivo",
    "URLPhoto": "http://andina.pe/agencia/foto-el-ministro-salud-oscar-ugarte-participo-el-taller-comunicacion-riesgo-experiencia-de-preparacion-contra-pandemia-influenza-foto-andina-ruben-grandez-96223.aspx"
  },
  {
    "idFotografia": 96226,
    "Leyenda": "El Ministro de Salud, Oscar Ugarte,declara luego de participar en el taller de comunicación de riesgo: \"La experiencia de la preparación contra la pandemia de influenza\". \r\nFoto: ANDINA / Rubén Grández.",
    "Descripcion": "",
    "Fecha": "2009-05-28T00:00:00",
    "Imagen": "000096226M.jpg",
    "Seccion": "Política",
    "Fotografo": "ANDINA/archivo",
    "URLPhoto": "http://andina.pe/agencia/foto-el-ministro-salud-oscar-ugartedeclara-luego-participar-el-taller-comunicacion-riesgo-experiencia-de-preparacion-contra-pandemia-influenza-\r\nfoto-andina-ruben-grandez-96226.aspx"
  }
]"

  

And this is the method in Jquery that runs through it, however it always returns undefined

function _loadFotografiasLanding() {

var ruta = '/landing.aspx/loadFotografiasTags';
$.ajax({
    type: 'POST',
    url: ruta,
    contentType: 'application/json; charset=utf-8',
    dataType: 'json',
    success: function (response) {
        console.log(response);
        var row = "";
        $.each(response, function () {
            $.each(this, function (index, item) {
                row += "Leyenda: " + item.idFotografia;
            });
        });
        
        $("#fotografias").html(row);
    },
    error: function () {
        alert("Error en la carga de Fotografias");
    },
});

}

Anyone have any idea what is happening? I would appreciate it very much. Thank you

0 Answers
Related