Conflicting jQuery no longer recognises SPServices

May 29, 2014 at 8:12 PM
Hi

I've written code which is building html based on a list and library in O365. In my own environment it works fine. When testing on the client site $().SPServices({ line returns the error Object doesn't support property of method 'SPServices'

Looking in the sources JQuery is being loaded twice, if I remove the reference I've added to jQuery I get SPServices claiming jQuery hasn't been loaded.

The versions of jQuery being loaded are 1.10.1 and 1.10.2. I'm loading 2014.01 SPServices.

The code is
//Global variables
var guideHtml="";
var chapHtmlUL="";
var chapHtmlBut="";
$(document).ready(function(){
    
    getGuides();
    //alert(guideHtml);
    $("#portal").html(guideHtml);
});

//Get from GuideList all guide rows
function getGuides(){
    //Web service we are calling
    var method = "GetListItems";

    //List contain nav details (use display name)
    var list = "GuideList";

    //details of fields to be used (use internal names)
    var fieldsToRead =  "<ViewFields>" +
                            "<FieldRef Name='Title' />" +
                            "<FieldRef Name='GuideImageURL' />" +
                            "<FieldRef Name='GuideNumber' />" +
                            "<FieldRef Name='GuideSupportURL' />" +
                            "<FieldRef Name='GuideURL' />" +
                            "<FieldRef Name='GuideWhat' />" +
                            "<FieldRef Name='GuideWho' />" +
                        "</ViewFields>";

    //CAML query to filter and sort the data by GuideNumber
    var query = "<Query>" +
                    "<Where>" +
                        "<Neq>" +
                            "<FieldRef Name='ID'/><Value Type='Number'>0</Value>" +
                        "</Neq>" +
                    "</Where>" +
                    "<OrderBy>" +
                        "<FieldRef Name='GuideNumber' />" +
                    "</OrderBy>" +
                "</Query>";
    
    //SPServices call to get the data
    $().SPServices({
        operation: method,
        async: false,
        listName: list,
        CAMLViewFields: fieldsToRead,
        CAMLQuery: query,
        completefunc:function(xData, Status){
            $(xData.responseXML).SPFilterNode("z:row").each(function() {
                //Populate variables with field values
                var guideTitle = ($(this).attr("ows_Title"));
                var guideNumber = ($(this).attr("ows_GuideNumber"));
                var guideImageURL = ($(this).attr("ows_GuideImageURL")).split(",")[0];
                var guideImageALT = ($(this).attr("ows_GuideImageURL")).split(",")[1];
                var guideWhat = ($(this).attr("ows_GuideWhat"));
                var guideWho = ($(this).attr("ows_GuideWho"));
                var guideComplete = ($(this).attr("ows_GuideURL")).split(",")[0];
                var guideSupport = ($(this).attr("ows_GuideSupportURL")).split(",")[0];
                getChapters(guideNumber);
                addGuide(guideTitle,guideNumber,guideImageURL,guideImageALT,guideWhat,guideWho,guideComplete,guideSupport);
            });
        }
    });
}
Any ideas?

Regards,

Laura GB
Coordinator
May 30, 2014 at 3:58 AM
Laura:

You should track own where the other version of jQuery is coming from. Either 1.10.1 and 1.10.2 should be fine.

If you're getting "Object doesn't support property of method 'SPServices'", then it's SPServices that's not loading.

M.
May 30, 2014 at 7:54 AM
Thanks for your fast reply Marc.

I'm going to investigate the other version of jQuery being loaded. SPServices and see how I get on.

Laura GB