SPServices 使用示例

SPServices使用示例。更新中...

1、獲取列表項附件的例子:

http://spservices.codeplex.com/discussions/400677

$().SPServices({
		operation: "GetAttachmentCollection",
		listName: "MahAwesomeListName",
		ID: id,
		completefunc: function( xData, Status ) {
			//console.log( Status );
			//console.log( xData.responseText );
		
			var output = ""
			
			;
			
			//debugger;
			
			$( xData.responseXML ).find("Attachments > Attachment").each(function( i, el ) {
				var $node = $(this),
					filePath = $node.text(),
					arrString = filePath.split("/"),
					fileName = arrString[ arrString.length - 1 ]
				;
				
				output += "<a href='" + filePath + "' target='_blank'>" + fileName + "</a><br />";
			});
			
			$("#drop-zone").html( output );
		}
	});


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章