The code below apparently executes the web service and returns values, but ignores the where clause (thus returning all the items in the list). This is the simplest form of problem that I have encountered.
The TestQuery list is a simple user list with no user-defined fields. Can anyone understand why the filter is not working?
<body>
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
<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/'>";
soapEnv += "<listName>TestQuery</listName>";
soapEnv += "<Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>One</Value></Eq></Where></Query>";
soapEnv += "<ViewFields><ViewFields><FieldRef Name='Title'/></ViewFields></ViewFields><RowLimit>1</RowLimit>";
soapEnv += "</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) {
$('#WSResponse').text(status);
$(xData.responseXML).find("z\\:row").each(function() {
var liHtml = "<li>" + $(this).attr("ows_Title") + "</li>";
$("#tasksUL").append(liHtml);
});
}
</script>
<ul id="tasksUL"/>
<div id="WSResponse"/>
</body>
source
share