I am trying to get the created by from a SharePoint custom list. i am not sure what i an doing wrong. it return a row and i can get the ows_Title. Can someone help me. I have tried CAMLViewFields: "<ViewFields Properties='True' />", as well but no luck.
Here is the code.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script><!-- Reference SPServices on cdnjs (Cloudflare) --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/0.7.2/jquery.SPServices-0.7.2.min.js" type="text/javascript"></script>
$().SPServices({
liHtml = liHtml + "<li>" + $(this).attr("ows_Title") + "-------------"+ $(this).attr("ows_Author") +"</li>";
$("#targetDIV").html(liHtml);
Here is the code.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script><!-- Reference SPServices on cdnjs (Cloudflare) --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/0.7.2/jquery.SPServices-0.7.2.min.js" type="text/javascript"></script>
$().SPServices({
operation: "GetListItems",
async: false,
listName: "WikiComments",
CAMLViewFields: "<ViewFields >" +
"<FieldRef Name='Created'></FieldRef>" +
"<FieldRef Name='ows_Author'></FieldRef>" +
"<FieldRef Name='ows_Editor'></FieldRef>" +
"</ViewFields>",
CAMLQuery: "<Query><Where><Eq><FieldRef Name='WikiID'/><Value Type='Text'>" + _spPageContextInfo["pageItemId"] + "</Value></Eq></Where></Query>", completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function() {
alert("Author: "+$(this).attr("ows_Author")+" Editor: "+$(this).attr("ows_Editor"));liHtml = liHtml + "<li>" + $(this).attr("ows_Title") + "-------------"+ $(this).attr("ows_Author") +"</li>";
$("#targetDIV").html(liHtml);
});
}
});
}); </script><div id="targetDIV" style="border-top: 1px; border-right: 1px; border-bottom: 1px; border-left: 1px"></div>