控制台日志:
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引用在点击时丢失了?
任何人都可以对此有所了解吗?
答案 0 :(得分:3)
Jquery被定义了两次,导致SPServices无法正确加载。