I need to get data from two customs lists that I created. However only the first list item is queried allowing me to use the data in the Home Page list item only, but I need both.
var listItems;
var listItemPics;
function GetListItems(SPHostUrl){
var SPContext = new SP.ClientContext.get_current(SPHostUrl);
var web = SPContext.get_web();
var List = web.get_lists().getByTitle("Home Page");
var picsList = web.get_lists().getByTitle("Pictures");
var query = new SP.CamlQuery();
query.set_viewXml('<View><Query><Where><Geq><FieldRef Name=\'ID\'/>' +
'<Value Type=\'Number\'>0</Value></Geq></Where></Query><RowLimit>30</RowLimit></View>');
listItems = List.getItems(query);
listItemPics = picsList.getItems(query);
SPContext.load(listItems);
SPContext.load(listItemPics);
SPContext.executeQueryAsync(GetListItems_Successor, GetListItems_Fail);
}
GetItemsFunction
function GetListItems_Successor(sender, args){
var listItemInfo = '';
var listItemEnumerator = listItem.getEnumerator();
var picItemEnumerator = listItemPics.getEnumerator();
while (picItemEnumerator.moveNext()){
var picsItem = picItemEnumerator.get_current();
var title = picsItem.get_item('Title');
var url = picsItem.get_item('URL'); }
while (listItemEnumerator.moveNext()){
var oListItem = listItemEnumerator.get_current();
var title = oListItem.get_item('Title');
var url = oListItem.get_item('URL'); }}
while
statement.