3

I have added terms in termset and need to loopthrough the terms in javascript to get the array of terms. so i used spservice. but not working

 function GetTerm() {
   var termStore = document.getElementById('<%=TermStoreID.ClientID=%>').value.toString();
    var termSet = document.getElementById('<%=TermSetID.ClientID %>').value.toString();
    var name = new Array();
   var index = 0;
    $().SPServices({
        operation: "GetChildTermsInTermSet",
        sspId: termStore,
        lcid: 1033,
        termSetId: termSet,
        completefunc: function (xData, Status) {
           alert("ok");
        }
    });
    return name;
}

not even the alert message is displaying

5
  • what are you trying to do? There might be better solutions... Commented Apr 25, 2012 at 11:02
  • i need to get the terms in the term set and store in array.
    – yogesh
    Commented Apr 25, 2012 at 13:46
  • Are you certain the termStore and termSet variables comes back with the correct guid? Commented Apr 25, 2012 at 13:59
  • the guid is correct but the service is not triggerring.
    – yogesh
    Commented Apr 25, 2012 at 14:27
  • I need to query out all the 1st level terms of a termset and store in array. Did you fix your code? Could you give me an example if possible?
    – Mark L
    Commented May 20, 2016 at 8:28

1 Answer 1

1

From the sounds of it, you need to do some debugging. If "the service is not triggerring", there is likely an error of some sort.

First check to make sure your references to jQuery and SPServices are correct (this causes a suprising majority of first time issues). See my post Adding jQuery+SPServices to a SharePoint Page: Step One, Always.

Assuming that your references are good, add alert(xData.responseText); in the completefunc to see what's returned from the Web Service call.

M.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.