im scripting in sharepoint2010 foundation, using jquery/javascript. this is a question about jquery spservices.

im trying to get fieldvalues from a list and use the values in another list.

$().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.

Note that if the WorkCity column is empty, you'll get undefined in your code. Items are stored sparsely.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top