控制台日志:
Uncaught TypeError: undefined is not a function index.html:77
LoadCat index.html:77
(anonymous function) index.html:107
n.event.dispatch jquery.js:3
r.handle
代码:
function LoadCat(cat) {
if (cat != null) {
var CAML = '<Query><Where><Eq><FieldRef Name="Department" /><Value Type="Text">' + cat + '</Value></Eq></Where></Query>';
}
else {
var CAML = '';
}
var liHtml = "Category: <select name=\"categoryselect\" id=\"categoryselect\">";
$().SPServices({
operation: "GetListItems",
async: false,
webURL: "PSS/StaffShop/",
listName: "Categories",
CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>",
CAMLQuery: CAML,
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function () {
liHtml = liHtml + "<option value=\"" + $(this).attr("ows_Title") + "\" >" + $(this).attr("ows_Title") + "</option>";
});
liHtml = liHtml + "</select>";
$("#cat").html(liHtml);
}
});
}
代码调用:
$('.area').click(function(){
alert($(this).attr("href"));
LoadCat();
});
代码在这一行失败:
$().SPServices({
然而
- JQuery is loaded
- SPServices is loaded
- Function is called in document ready
感兴趣的人可以在这里找到完整的代码:http: //pastebin.com/NvSCjV72
编辑:
似乎 SPServices 引用在单击时丢失了?
任何人都可以对此有所了解吗?