Loading...

RE: Getting a single item back from a list…

RE: Getting a single item back from a list…

#5003
Anonymous
Anonymous
Participant

For some reason the code was removed… here it is:

$(document).ready(function() {

  $().SPServices({

    operation: "GetListItems",

    listName: "User Information List",

    CAMLViewFields: "<ViewFields><FieldRef Name='Picture' /><FieldRef Name='ID' /></ViewFields>",

    CAMLQuery: "<Query><Where><Eq><FieldRef Name='Title' /><Value Type='Text'><%Created By%></Value></Eq></Where><OrderBy>Created</OrderBy></Query>",

    completefunc: function (xData, Status) {

      $(xData.responseXML).find("z\\:row, row").each(function() {

        var photo1 = "<a href='../_layouts/userdisp.aspx?ID=" + $(this).attr("ows_ID") + "' target='_blank'><img width='110' height='145' class='postedby_photo' src='" + $(this).attr("ows_Picture").split(', ')[0] + "'/></a>";

        $("#photo").append(photo1);

      });

    }

  });

});

</script>

<span id='photo'></span>