Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Ok, so here's the rundown. I have a site with three child sites, and I am trying to get a rollup of content from these three sites. Each site has the same list of "Initiatives" and on the parent site the client would like to see All of the initiatives. This works fantastically in FF, however i just get an exception thrown in IE. Here is the code:

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/0.7.1a/jquery.SPServices-0.7.1a.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
        var subSite = new Array();

        $().SPServices({
        operation: "GetAllSubWebCollection",
        completefunc: function(xData, Status) {
            $(xData.responseXML).find("Webs > Web").each(function() {
                var $node = $(this);
                var siteTitle = $node.attr("Title").replace(/\s/g, "");
                subSite.push( siteTitle );
            });
            }
        }); 

        for(i=0;i<4;i++){       
            $().SPServices({
                operation: "GetListItems",
                webURL: "/"+subSite[i]+"",
                async: false,
                listName: "Initiatives",
                CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>",
                completefunc: function(xData, Status){

                    alert(xData.responseText);
                    console.log( xData.responseText );
                    $(xData.responseXML).SPFilterNode("z:row").each(function(){
                        var liHtml = "<li><a href='/"+subSite[i]+"/SitePages/InitiativeOverview.aspx?"+$(this).attr('ows_Title')+"'>" + $(this).attr("ows_Title") + "</a></li>";
                        $("#initiativeList").append(liHtml);
                    });//end xData
                }//end function
            });//end SPServices
        }//end for
    });
    </script>

Any thoughts or guidance is greatly appreciated. I don't know why this wouldn't work, I have tried using the alternative z\:row in the SPFilterNode and it still returns nothing but an exception.

The exception is:

LOG: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.</faultstring><detail><errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">There is no Web named "/undefined/_vti_bin/Lists.asmx".</errorstring></detail></soap:Fault></soap:Body></soap:Envelope>

Again, thanks for any input!!

share|improve this question

3 Answers 3

up vote 1 down vote accepted

You don't have async: false, on the first SPServices call to get the sites, so IE is probably just behaving as expected and continues to make the new requests without anything entered into subSites.

I don't know why FF fails to run the request async, but that just shows you shouldn't use that if you want right behaviour

share|improve this answer
    
This was it, Dumb...Dumb...Dumb... Thanks Per Jakobsen –  Brenton Pierce May 24 '12 at 19:30

My guess is that something gets screwed up in this line: webURL: "/"+subSite[i]+"" as the error states: There is no Web named "/undefined/_vti_bin/Lists.asmx

If you debug the for loop, are you getting results for all the iterations?

share|improve this answer
    
It is getting stopped there. I changed the line for(i=1...) and it is still coming accross as undefined the first loop through, any ideas? –  Brenton Pierce May 24 '12 at 18:50

An easy fix (and better codeing practice) would be to change your for loop to something like this:

for(i=0;i<subSite.count();i++){  

Based on your code it seems like you want to loop through every site returned, not 4 sites regardless of how many sites are returned. As far as why a different number of sites are being returned in IE vs FF, I'm not quite sure. If you post your xData.responseXML from IE and from FF, I might be able to help more.

share|improve this answer
    
The same number of sites are being returned in FF, and the same exception is being thrown in FF however FF just ignores it and keeps chugging. –  Brenton Pierce May 24 '12 at 19:07
    
Can you post your xData.responseXML? –  Abe Miessler May 24 '12 at 19:09
    
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="schemas.xmlsoap.org/soap/envelope/"; xmlns:xsi="w3.org/2001/XMLSchema-instance"; xmlns:xsd="w3.org/2001/… of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.</faultstring><detail><errorstring xmlns="schemas.microsoft.com/sharepoint/soap/">There is no Web named "/GST/_vti_bin/Lists.asmx".</errorstring></detail></soap:Fault></soap:Body></soa‌​p:Envelope> –  Brenton Pierce May 24 '12 at 19:15
    
Not sure if that's what you want? –  Brenton Pierce May 24 '12 at 19:15
    
It's the xData.responseXML from the first request we need to see why you don't get the site information when running IE –  Per Jakobsen May 24 '12 at 19:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.