简体   繁体   English

jQuery spservices

[英]jquery spservices

im scripting in sharepoint2010 foundation, using jquery/javascript. 使用jquery / javascript在sharepoint2010基础中编写即时消息脚本。 this is a question about jquery spservices. 这是关于jquery spservices的问题。

im trying to get fieldvalues from a list and use the values in another list. 我试图从一个列表中获取fieldvalues,并使用另一个列表中的值。

$().SPServices({
  operation: 'GetListItems',
  async: false,
  listName: 'Bedrijven',
  CAMLRowLimit: 10,
  CAMLQuery: _queryCompanie,
  CAMLViewFields: "<ViewFields><FieldRef Name='WorkPhone'/><FieldRef Name='WorkCity' /><FieldRef Name='Title' /></ViewFields>",
  completefunc: function(xData, Status){
    $(xData.responseXML).SPFilterNode("z:row").each(function(){
      var _itemTitle = $(this).attr('ows_Title');
      var _itemCity = $(this).attr('ows_WorkCity');

      alert('WorkCity == ' + _itemCity);
    });
  }
});

the problem is, im getting the title field, but i also need the workcity field. 问题是,即时通讯获得标题字段,但我也需要工作城市字段。 but if im doing it as above im getting undefined back when i alert it. 但是如果我按上述方式进行即时通讯,则当我提醒它时我将无法得到定义。

thanks in advance. 提前致谢。

I just ran this in my test environment with a Contacts list as the source, and it worked for me. 我只是在测试环境中以“联系人”列表作为源运行了它,并且对我有用。 You might want to check the returned data in Firebug or Fiddler to see what's happening. 您可能要检查Firebug或Fiddler中返回的数据,以查看发生了什么情况。

Note that if the WorkCity column is empty, you'll get undefined in your code. 请注意,如果WorkCity列为空,则在代码中将无法定义。 Items are stored sparsely. 项目稀疏存储。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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