2

I'm interviewing for a company and they asked me to put together some demos for them. They have a platform they use on top of Sharepoint and I would be working extensively in it (this is a junior position so sorry if the question is stupid). They want me to populate a slider with data from a JSON file they gave me, but I'm not sure how to deal with the namespaces and stuff that are injected by Sharepoint. Can anyone point me in the right direction?

Here's the JSON data: http://jsfiddle.net/x3fkq6ox/

Thanks!

2

The following example demonstrates how to read Json file and parse it (the data from your JSFiddle has been saved into file):

$.getJSON("/SiteAssets/Announcements.data", function(data) {
    var rowsData = data.NewDataSet.GetListItems.listitems['rs:data']['z:row'];
    var content = renderRows(rowsData);
    $('#listview').append(content);
});


function renderRows(rows)
{
    var template = '';
    for(var i = 0; i < rows.length; i++) {
        var title = rows[i]['ows_Title'];
        var body = rows[i]['ows_Body'];
        template += String.format('<div><h2>{0}</h2><div>{1}</div></div>',title,body); 
    }
    return template;
}

Result

enter image description here

0

Angular JS is one of the approach you can try.

http://jsfiddle.net/7sm9r76o/6/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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