如果列值包含" Some Value"我正在尝试从SharePoint列表中获取所有项目。我得到的项目数是正确的,但我的项目对象" liHtml"总是回来未定义。
<script language="javascript" src="//code.jquery.com/jquery-1.6.2.min.js" type="text/javascript"></script>
<script language="javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2014.02/jquery.SPServices-2014.02.min.js" type="text/javascript"></script>
$(document).ready(function() {
GetAllListItem();
});
function GetAllListItem()
{
$().SPServices({
operation: "GetListItems",
async: false,
listName: "TestList",
CAMLQuery: "<Query><Where><Eq><FieldRef Name='ServerStatus' /><Value Type='Text'>Some value</Value></Eq></Where></Query>",
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function() {
var liHtml = "<li>" + $(this).attr("ows_Title") + "</li>";
alert(liHtml);
});
}
});
}
答案 0 :(得分:0)
试试这个
<script language="javascript" src="//code.jquery.com/jquery-1.6.2.min.js" type="text/javascript"></script>
<script language="javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2014.02/jquery.SPServices-2014.02.min.js" type="text/javascript"></script>
$(document).ready(function() {
GetAllListItem();
});
function GetAllListItem()
{
$().SPServices({
operation: "GetListItems",
async: false,
listName: "TestList",
CAMLQuery: "<Query><Where><Eq><FieldRef Name='ServerStatus' /><Value Type='Text'>Some value</Value></Eq></Where></Query>",
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function(node) {
var liHtml = "<li>" + $(node).attr("ows_Title") + "</li>";
alert(liHtml);
});
}
});
}