我有以下代码:
function ViewItems() {
var liHtml = ''; //Set the variable to nothing
alert($('#categoryselect').val());
$().SPServices({
operation: "GetListItems",
async: false,
listName: "Items",
CAMLQuery: "<Where><Eq><FieldRef Name='Category'/><Value Type="Lookup">" + $('#categoryselect').val() + "</Value></Eq></Where>",
CAMLViewFields: "<ViewFields><FieldRef Name='Title' /><FieldRef Name='Image' /></ViewFields>",
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function() {
liHtml = liHtml + "<h1>" + $(this).attr("ows_Title") + "</h2><br /> <img width=\"150px\" src=\"" + ($(this).attr("ows_Image")).split(", ")[0] + "\" /><br /> <a id=" + $(this).attr("ows_ID") + " class=\"addtobasket\">[Add To Basket]</a>";
});
$("#tasksUL").html(liHtml); //Fill the div with the liHTML
}
});
}
在 IE 中调试时出现以下错误:
网页错误详情
用户代理:Mozilla/4.0(兼容;MSIE 8.0;Windows NT 6.1;Trident/4.0;SLCC2;.NET CLR 2.0.50727;.NET CLR 3.5.30729;.NET CLR 3.0.30729;Media Center PC 6.0;.NET4 .0C;.NET4.0E;InfoPath.3) 时间戳:2014 年 3 月 19 日星期三 15:27:28 UTC
Message: Expected '}'
Line: 74
Char: 77
Code: 0
URI: MY SP Site
Message: Could not complete the operation due to error 80020101.
Line: 2
Char: 2568
Code: 0
URI: /Assets/jquery.js
第 74 行是:
async: false,
如果我没有指定值类型,我不会收到错误,但是查询返回 0 个结果。