首页 > 代码库 > sharepoint JQ获取List列表的值

sharepoint JQ获取List列表的值

 <script type="text/javascript">
  function getlistitem()
  {
  var mycontext=new SP.ClientContext();
  var mysite=mycontext.get_web();
  var query = new SP.CamlQuery();
  query.set_viewXml("<View><Query></Query></View>");

  var mylist=mysite.get_lists().getByTitle(‘test‘);
 myitem= mylist.getItems(query);

 mycontext.load(myitem);
 mycontext.executeQueryAsync(Function.createDelegate(this,this.getsuccessed),Function.createDelegate    

  (this,this.getfailed));
   }
   function getsuccessed()
   {
  var str="";
var gh="";
   var listsE=myitem.getEnumerator();
   while(listsE.moveNext())
  {
gh+=listsE.get_current().get_item("_x5de5__x53f7_")+"<br>";
   str+=listsE.get_current().get_item("Title")+"<br>";
  }
   document.getElementById("lists").innerHTML=gh;

  }
  function getfailed(sender,args)
   {
  alert("failed~!");
  }
  </script>

  <div><input value="http://www.mamicode.com/get2" type="button" onclick="getlistitem()"/></div>
  <div id="lists"></div>
<div id="listg"></div>

sharepoint JQ获取List列表的值