Failed access to SPServices in a SharePoint list

2

I created a SPServices that queries a list in SharePoint 2010 and returns the value of a single field. However, this query is returning the following error:

soap:ServerException of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.Não existe nenhuma Web chamada "/blog/Lists/Postagens/_vti_bin/Lists.asmx".

My code is as follows:

var queryText = "<Query>"+
                    "<Where>"+
                        "<Eq>"+
                            "<FieldRef Name='ID'/>"+
                                "<Value Type='Number'>" + IDPost + "</Value>"+
                        "</Eq>"+
                    "</Where>"+
                "</Query>";

 $().SPServices({
    operation: 'GetListItems',
    async: false,
    listName: 'Postagens',
    webURL: 'http://site/subsite/Lists/Postagens/',
    CAMLViewFields: '<ViewFields>'+
                        '<FieldRef Name="Curtir" />'+
                    '</ViewFields>',
    CAMLQuery : queryText,      
    completefunc: function (xData, Status) {
        $(xData.responseXML).SPFilterNode('z:row').each(function() {
            CurtirTot = $(this).attr('ows_Curtir');
        });
    }
});

I searched on google, but the closest result I got was "Connectivity failure"
Can anyone tell me if I need to configure something else in SharePoint to work correctly on SPServices or is there some error in the code?

    
asked by anonymous 16.05.2014 / 23:02

1 answer

1

The webURL option should indicate the path of a site. In your code it indicates the path of a list.

Modify the value of the option to contain the path only to the site, ie assuming the site is called "subsite" and is in the domain in> would look like this:

...
    webURL: ''http://site/subsite/'',
...
    
16.05.2014 / 23:24