pass urls selected items to aapplication page
i created ribbon button that pass url selected item on application page. my code is
var listitem = '';
var ctx = SP.ClientContext.get_current();
var hostaddress = window.location.protocol + '//' + window.location.hostname + ':' + window.location.port;
var currentWeb = ctx.get_web();
ctx.load(currentWeb);
var currentListGuid = SP.ListOperation.Selection.getSelectedList();
var currentList = currentWeb.get_lists().getById(currentListGuid);
ctx.load(currentList);
var selectedItems = SP.ListOperation.Selection.getSelectedItems();
var k = '';
for (k in selectedItems)
{
listitem = currentList.getItemById(selectedItems[k].id);
ctx.load(listitem);
ctx.executeQueryAsync(Function.createDelegate(listitem, function ()
{
var leafUrl=listitem.get_fieldValues().FileRef;
itemUrl = hostaddress + leafUrl;
alert(itemUrl);
var options = {
url: '/_layouts/RibbonCopyMove/CopyMovePage.aspx?items=' + itemUrl,
tite: 'Move Documents',
allowMaximize: false,
showClose: true,
width: 600,
height: 500 };
SP.UI.ModalDialog.showModalDialog(options);
}), null);
}
i want pass urls of all selected items to application page. with my code when select one item i receive ok url but when i select two or more items i receive undefinied url. how i solve this situation?