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


SPServices() uses wrong server relative URL on SP2010



Calling SPServices() from a page located at root website Pages library (e.g. http://<server>/Pages/default.aspx) to access a list at same level (e.g. http://<server>/Lists/MyList) might try to access an incorrect URL.

Steps to reproduce:

  1. Create a Publishing site
  2. Create a page in /Pages library (e.g. default.aspx)
  3. Create a custom list in /Lists (e.g. MyList)
  4. Use following code in default.aspx from a Content Editor Web Part pointing to existing file with the code (SP2010):
    operation: "GetListItems",
    async: false,
    listName: "MyList",
    CAMLQuery: "",
    CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>",
    completefunc: function(xData, status)
        if (status == "error")
            console.log("Error: " + xData.statusText);
            var rows = $(xData.responseXML).SPFilterNode("z:row");

            console.log("Rows retrieved: " + rows.length);
  1. Save and browse the page
  2. Console will display the message "Error: Transport error" as jQuery AJAX request tries to access //_vti_bin/Lists.aspx instead of /_vti_bin/Lists.aspx (notice the double-slash at the beginning).


Modify jquery.SPServices-2013.01.js file at line 428 from:
ajaxURL = $().SPServices.SPGetCurrentSite() + SLASH + ajaxURL;
so it runs following code:
var currentSite = $().SPServices.SPGetCurrentSite();
ajaxURL = currentSite + (currentSite !== SLASH ? SLASH : "") + ajaxURL;
Closed Dec 28, 2013 at 7:49 PM by sympmarc
Released in 2013.02


sympmarc wrote Oct 8, 2013 at 9:37 PM

Implemented in 2013.02ALPHA3

ptavares wrote Oct 16, 2013 at 12:22 AM

I think I just got bit by this (was running ALPHA2 to test the GetItemChangesSinceToken issue)... When you get a chance, can you post 2013.02ALPHA3 ?


sympmarc wrote Oct 16, 2013 at 1:38 AM


ptavares wrote Oct 16, 2013 at 2:23 AM

Wow. Now that was quick. Thanks Marc.