I have a termstore like below (sample one)
i need to write a JSOM code to get sub terms under a particular term set As an example once i put My term set's uniquie ID i should reterive My term1,2,3 as my out put
Thank you much.
I followed following code but it does not give proper outcome.
function showTermSets(groupId) {
//we need to load and populate the matching group first, or the term sets that it contains will be inaccessible to our code.
var groupEnum = groups.getEnumerator();
while (groupEnum.moveNext()) {
var currentGroup = groupEnum.get_current();
if (currentGroup.get_id() == groupId) {
context.load(currentGroup);
context.executeQueryAsync(
function(){
//Get Term Sets and load them.
var termSets = currentGroup.get_termSets();
context.load(termSets);
context.executeQueryAsync(
function(){
var termSetEnum = termSets.getEnumerator();
var termSetList = "Term Sets: \n"
while(termSetEnum.moveNext()){
var currentTermSet = termSetEnum.get_current();
var termSetName = currentTermSet.get_name();
var termSetId = currentTermSet.get_id();
termSetList += termSetName + ": " + termSetId + "\n";
}
alert(termSetList);
},
function(){
//Failure loading Term Sets
});
},
function () {
//Failure loading Group.
});
break;
}
}
}