2014-04-22 37 views
-1

控制台登录:未定义是不是一个函数 - SPServices

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参考正在丧失上点击?

任何人都可以对此有所了解吗?

回答

3

Jquery被定义了两次,导致SPServices无法正确加载。

相关问题