This is my simple application in this application I fetch the SharePoint Document Library please see the code now I want to show only particular item in Library when user click on any document name.
When user click in document name my sharepoint site must open and show my Document lib.
function StoreInArray() {
var CallLibrary = GetListItems();
$.when(CallLibrary).then(function (FilesData) {
for (var i = 0; i < FilesData.d.results.length; i++) {
var name = FilesData.d.results[i].Name;
var url = FilesData.d.results[i].ServerRelativeUrl;
var newDiv = document.createElement('div');
// Here I show document name and create link to open the sharepoint site
$('#DocName').append("<div><a href='' >" + name + "</a></div>");
}
});
}
function GetListItems() {
var siteURL = "http://localhost:8032/_api/web/GetFolderByServerRelativeUrl('docList')/Files";
return $.ajax({
url: siteURL,
async: false,
method: "GET",
headers: { "Accept": "application/json;odata=verbose" }
});
}