var urllink="https://stagetest.com"; var username=""; var listItemInfoAdmin1 =""; var listItemInfoAdmin2 =""; var listItemInfoCOS =""; $(document).ready(function () { username = $("#peoplepickerID").text(); //alert(username); AdminSupportStaff1(); AdminSupportStaff2(); ChiefOfSupportStaff(); }); function AdminSupportStaff1() { $.ajax({ url: urllink + "/sites/DL/LD/_api/web/lists/getbytitle('People')/items?$filter=AdminSupportStaff eq '" + username + "'", type: "GET", headers: { "Accept": "application/json;odata=verbose" }, cache: false, success: function (data) { $.each(data.d.results, function (key, value) { listItemInfoAdmin1 +="<tr><td>"+value.First_x0020_Name+" "+value.Last_x0020_Name+"</td><td>Admin</td></tr>"; }); $('#tableSupport').append(listItemInfoAdmin1); //$("#countmein").html(listItemInfo); }, error: function (data) { //myApp.hidePleaseWait(); // DisplayErrorMessage(errorMsg); alert("Error"); } }); } function AdminSupportStaff2() { $.ajax({ url: urllink + "/sites/DL/LD/_api/web/lists/getbytitle('People')/items?$filter=AdminSuppoprtStaff2 eq '" + username + "'", type: "GET", headers: { "Accept": "application/json;odata=verbose" }, cache: false, success: function (data) { $.each(data.d.results, function (key, value) { listItemInfoAdmin2 +="<tr><td>"+value.First_x0020_Name+" "+value.Last_x0020_Name+"</td><td>Admin</td></tr>"; }); $('#tableSupport').append(listItemInfoAdmin2); //$("#countmein").html(listItemInfo); }, error: function (data) { //myApp.hidePleaseWait(); // DisplayErrorMessage(errorMsg); alert("Error"); } }); } function ChiefOfSupportStaff() { $.ajax({ url: urllink + "/sites/DL/LD/_api/web/lists/getbytitle('People')/items?$filter=ChiefOfSupportStaff eq '" + username + "'", type: "GET", headers: { "Accept": "application/json;odata=verbose" }, cache: false, success: function (data) { $.each(data.d.results, function (key, value) { listItemInfoCOS +="<tr><td>"+value.First_x0020_Name+" "+value.Last_x0020_Name+"</td><td>Chief of staff</td></tr>"; }); $('#tableSupport').append(listItemInfoCOS); //$("#countmein").html(listItemInfo); }, error: function (data) { //myApp.hidePleaseWait(); // DisplayErrorMessage(errorMsg); alert("Error"); } }); }
Sunday, April 3, 2016
Read the sharepoint 2013 list data using REST and render into Table
Subscribe to:
Post Comments (Atom)
HTML
Script:
No comments:
Post a Comment