Guest User

Untitled

a guest
Dec 16th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. $(document).ready(function() {
  2. getItems();
  3. });
  4.  
  5.  
  6. function getItems() {
  7.  
  8. $.ajax({
  9.  
  10. async: true,
  11. url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('Global')/items?$filter=Title eq Domain",
  12. method: "GET",
  13.  
  14. headers: {
  15. "accept": "application/json;odata=verbose",
  16. "content-type": "application/json;odata=verbose"
  17.  
  18. },
  19. success: function(data) {
  20. data = data.d.results;
  21. console.log(data);
  22. $.each(data, function(index, value) {
  23.  
  24. if (value.Title == null) {
  25. value.Title = "";}
  26. else{
  27. value.Title = value.Title ;}
  28.  
  29. if (value.Grouped_x0020_OPUs == null) {
  30. value.Grouped_x0020_OPUs = "";}
  31. else{
  32. value.Grouped_x0020_OPUs = value.Grouped_x0020_OPUs;}
  33.  
  34.  
  35. if (value.Phase == null) {
  36. value.Phase = "";}
  37. else{
  38. value.Phase = value.Phase ;}
  39.  
  40. if (value.Stage == null) {
  41. value.Stage = "";}
  42. else{
  43. value.Stage = value.Stage ;}
  44.  
  45.  
  46. var html = "<tr><td>" + value.Title + "</td><td>" + value.Grouped_x0020_OPUs + "</td><td>" + value.Phase + "</td><td>" + value.Stage + "</td></tr>";
  47. $('.table tbody').append(html);
  48.  
  49. });
  50.  
  51. table = $('#table_id').DataTable();
  52.  
  53. },
  54. error: function(error) {
  55. console.log(JSON.stringify(error));
  56.  
  57. }
  58.  
  59. })
  60.  
  61.  
  62. }
Add Comment
Please, Sign In to add comment