Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: Conflicting jQuery no longer recognises SPServices

$
0
0
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

Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>