2014-04-22 5 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

SPServices를 올바르게로드하지 못하게하는 Jquery가 두 번 정의되었습니다.