简体   繁体   中英

jquery spservices

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.

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