This project has moved. For the latest updates, please go here.

Help: Unable to Display Library or List from One Subsite on another SP Subsite

Jul 31, 2014 at 10:04 PM
Attempting to display a library or list sourced in one subsite in another subsite within the same SP 13' site collection. I'm using a content editor webpart on the page where I want the source content to show. I've stored the following code in a .txt file, saved in a document library within the subsite the content should display referenced in the content editor webpart.

Note the two alerts, which both work (display every time page is refreshed). What am I doing wrong?

<script src="//"></script>

<script language="javascript" type="text/javascript" src="//"></script>
<script language="javascript" type="text/javascript"> $(document).ready(function() { alert("hello"); $().SPServices({ operation: "GetListItems", async: false, listName: "Shared Documents", webURL: "http://blahblahblah", CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>", completefunc: function (xData, Status) { alert("hello 2"); $(xData.responseXML).SPFilterNode("z:row").each(function() { var liHtml = "<li>" + $(this).attr("ows_Title") + "</li>"; $("#tasksUL").append(liHtml); }); } }); }); </script> <ul id="tasksUL"/>
Aug 1, 2014 at 5:07 PM
I don't know that I've ever had to enable Cross-Origin Resource Sharing within a site collection but it couldn't hurt to try. Add a line at the top of the funciton....
$.support.cors = true;
Otherwise, the code looks pretty straight forward to me. You may want to try debug mode to read the full text of the returned XML or send it to the console. Alternatively, you can set up an alert for "xData.responseText" (where hello2 is now) to see what is coming back. You may not be able to view the complete string that way, though.

Aug 2, 2014 at 5:02 AM
If you're pulling data from a different site within the same Site Collection, just specifying the webURL ought to do it.

You say that both alerts are working, so what's the actual issue?