Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

JavaScript and REST not displaying data from a list in another Site Collection

$
0
0

Hello all,

I would like to pull items from a list in another Site Collection to display on a page in my main Site Collection. I have been following this blog, but am looking for something simple in regards to the UI.

http://blogs.msdn.com/b/richard_dizeregas_blog/archive/2013/04/01/cross-site-publishing-alternatives-in-sharepoint-online-office-365.aspx

When I say simple, I want to start by just displaying the title of an item from another list, and possibly link to it. My container, including the REST call would look like this:

<div id="divContentContainer"></div><script type="text/javascript">
    $(document).ready(function ($) {
        var basePath = "https://tenant.sharepoint.com/sites/somesite/_api/";
        $.ajax({
            url: basePath + "web/lists/GetByTitle('News')/items/?$select=Title&$filter=Feature eq 0",
            type: "GET",
            headers: { "Accept": "application/json;odata=verbose" },
            success: function (data) {
                //script to build UI HERE
            },
            error: function (data) {
                //output error HERE
            }
        });
    });</script>

My question is, what should I put in the section that is commented out named //script to build UI here, so I can output a simple list, much like the Content Query Web Part? More importantly, I am looking for some good references/best practices to pulling data from SharePoint lists in other Site Collections. I am using SharePoint Online, or else I would leverage the Cross-Site Publishing feature.

Thanks,

Kelly

 

Personal Blog: http://thebitsthatbyte.com




Viewing all articles
Browse latest Browse all 7589

Trending Articles



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