Attempting to retrieve items from a list where field School_id is equal to a school_id javascript variable, and using SPServices GetListItems operation.
If I run the script without the CAMLQuery: Parameter, it returns all items on the list which is great, however when I add the Query to filter my returns I get
POST [server Address redacted] 500 (Internal Server Error)
I assume there's something wrong with my Query, I've already tried removing the tags but yields same result.
Is it possible that it actually is a server side error despite it successfully returning data with the Query absent?
<script language="javascript" type="text/javascript">
// http://spservices.codeplex.com/wikipage?title=GetListItems&referringTitle=Lists
$(document).ready(function() {
var school_id = getQueryVariable("school_id");
$().SPServices({
operation: "GetListItems",
async: false,
listName: "Contacts",
CAMLViewFields: "<ViewFields><FieldRef Name='Title' /><FieldRef Name='FirstName' /></ViewFields>",
CAMLQuery: "<Query><Where><eq><FieldRef Name='school_x0020_id'/><Value Type='Text'>" + "4440" + "</Value> </eq> </Where></Query>",
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function() {
var liHtml = "<li>" + $(this).attr("ows_Title") + ", " + $(this).attr("ows_FirstName") + "</li>";
$("#ContactsUL").append(liHtml);
});
}
});
});
</script>
<ul id="ContactsUL"/>