I am using a web service and am trying to return the highest ID number from the Posts list with viewname {B9212691-1AF1-41AF-9DA7-6073ADDB091B}. So far I have the following.
<script type="text/javascript">
$(document).ready(function() {
var soapEnv =
"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
<soapenv:Body> \
<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
<listName>Posts</listName> \
<viewName>{B9212691-1AF1-41AF-9DA7-6073ADDB091B}</viewName> \
<View> \
<Query> \
<OrderBy> \
<FieldRef Name='ID' Ascending='False' /> \
</OrderBy> \
</Query> \
<RowLimit>1</RowLimit> \
</View> \
</GetListItems> \
</soapenv:Body> \
</soapenv:Envelope>";
$.ajax({
url: "_vti_bin/lists.asmx",
type: "POST",
dataType: "xml",
data: soapEnv,
complete: processResult,
contentType: "text/xml; charset=\"utf-8\""
});
});
function processResult(xData, status) {
$(xData.responseXML).find("z\\:row").each(function() {
var liHtml = "<li>" + $(this).attr("ows_ID") + "</li>";
$("#tasksUL").append(liHtml);
});
}
</script>
<ul id="tasksUL"/>