简体   繁体   中英

Getting List data from Sharepoint 2013 using javascript

I got a sharepoint 2013 with some data in a list like below

Ex :

Name | Employeetype| -------|-------------| John | Permanent | David | Temporary |

Now i need to display this data in a html table using javascript.

I got some code , but i dont know how to use that code. below is the code i got so far

<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="jquery.SPServices-0.5.6.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
  $().SPServices({
    operation: "GetListItems",
    webURL: "http://siteurl/Lists/test/AllItems.aspx",
    async: false,
    listName: "test",
    CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>",
    completefunc: function (xData, Status) {
      $(xData.responseXML).SPFilterNode("z:row").each(function() {
        var liHtml = "<li>" + $(this).attr("ows_Title") + "</li>";
        alert(liHtml);
        $("#tasksUL").append(liHtml);
      });
    }
  });
});

Can anybody help on this.

Help is very much appreciated.

You can Javascript client object model to perform basic tasks in sharepoint.

You can check the following link for more details:

http://msdn.microsoft.com/en-us/library/office/jj163201(v=office.15).aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM