This project has moved and is read-only. For the latest updates, please go here.

GetListItems method returns undefined value

Apr 29, 2015 at 8:46 PM
Edited Apr 29, 2015 at 8:56 PM
function ChangeEvent()
    var flightnumber =getTagFromIdentifierAndTitle("input","TextField","Flight #").value; 
    alert(flightnumber );
    var myQueryOptions = "<QueryOptions><ViewAttributes Scope = 'RecursiveAll' IncludeRootFolder='True'/></QueryOptions>";
    var myQuery = "<Query><Where><Eq><FleldRef Name='Flight_x0020_x0023_0' /><value Type='Number'>"+1119+"</Value></Eq></Where></Query>";

            operation: "GetListItems",
            async: false,
            listName: "Flights",
            CAMLViewFields: "<ViewFields><FieldRef Name='Flight_x0020_Type' /></ViewFields>",
            //CAMLQuery: myQuery,
            CAMLRowLimit: 100,
            //CAMLQueryOptions: myQueryOptions,
            completefunc: function (xData, Status) {
            $(xData.responseXML).find("[nodeName='z:row']").each(function () {
                var flightType = $(this).attr('ows_Flight_x0020_Type');

I have been using the above script. Somehow I am getting undefined. Can anyone help me out?
Apr 29, 2015 at 9:14 PM
My suggestion is to look at the network traffic to see whats going in the POST for the request and what's coming back in the response.

One thing that is pretty likely to cause a problem (at least in nonIE) is this:
Do this instead (as shown in the docs):
Apr 29, 2015 at 9:43 PM
Edited Apr 29, 2015 at 9:54 PM
Thanks for your reply. Interestingly I didn't see any POST in the network. So my understanding is that the function is never called. Did I miss anything in my script?

Below are my references:

<script type="text/javascript" src="/jQuery/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="/jQuery/jquery.SPServices-2014.02.min.js"></script>
<script type="text/javascript" src="/jQuery/jquery.SPServices-2014.02.js"></script>
Apr 29, 2015 at 10:15 PM
You're loading both the minified and non-minified copies of SPServices, which won't work:
<script type="text/javascript" src="/jQuery/jquery.SPServices-2014.02.min.js"></script>
<script type="text/javascript" src="/jQuery/jquery.SPServices-2014.02.js"></script>
It should be one or the other.

Otherwise, you'll just need to do some debugging. You've got a lot os commented and test code in there. I'd suggest stripping it down to the minimum to get it working and then building it back up.

Apr 29, 2015 at 10:56 PM
I removed the non-minified version and I added the webURL parameter. After adding that parameter I noticed the POST method in network traffic and it returned with the following error:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="" xmlns:xsi="" xmlns:xsd="">
<faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.</faultstring>
<detail><errorstring xmlns="">Value does not fall within the expected range.</errorstring></detail>

Thanks for the help..!
Apr 29, 2015 at 11:03 PM
This is where you need to do some debugging. Like I said, break it down to the simplest call you can and build up from there.

Apr 30, 2015 at 6:50 PM
if your running IE, hit F12 and see what the error is, also check your code, I ran into something like this and drove me nuts for an hour, then I found a typo in my jquery so the SPServices call was never being executed. Also, validate your CAML query with the CAML builder tool, make sure your getting data back from the list
Jun 9, 2015 at 4:12 PM
Gonna guess you figured out your issue was with your CAML - start <value Type... doesn't match end </Value> tag? Just asking because I'm running into the same issue but I've validating my CAML through and through.

var camlQuery = "<Query><Where><Contains><FieldRef Name='EncodedAbsUrl'/><Value Type='Computed'>"+itemUrl+"</Value></Contains></Where></Query>";