我的变量存在问题。我不确定它是否与语法相关,但出于某种原因,我的if
语句的第一部分与我的变量不起作用。
我在没有SPServices
的情况下对其进行了测试,如果我只是在没有SPServices
的情况下执行该功能,则可以正常运行。我还测试了SPServices
警报而不是变量,这些也很好。请参阅下面的代码,任何帮助表示赞赏。谢谢!
$(document).ready(function(){
var dropdown = $("select[title='Item-Status']");
$().SPServices({
operation: "GetGroupCollectionFromUser",
userLoginName: $().SPServices.SPGetCurrentUser(),
async: false,
completefunc: function(xData, Status) {
if ($(xData.responseXML).find("Group[Name='CCB Team']").length == 0) {
dropdown.find("option[value='QA Review']").remove();
} else if ($(xData.responseXML).find("Group[Name='QA Team']").length == 1) {
alert("You should see this");
}
}
});
});
答案 0 :(得分:0)
$(document).ready(function(){
$().SPServices({
operation: "GetGroupCollectionFromUser",
userLoginName: $().SPServices.SPGetCurrentUser(),
async: false,
completefunc: function(xData, Status) {
var dropdown = $("select[title='Item-Status']");
if ($(xData.responseXML).find("Group[Name='CCB Team']").length == 0) {
dropdown.find("option[value='QA Review']").remove();
} else if ($(xData.responseXML).find("Group[Name='QA Team']").length == 1) {
alert("You should see this");
}
}
});
});