We are working on a SharePoint 2013 on-premise farm. I am trying to return the termset object with ID 'xxxxx-xxxxx-xxxxx-xxxxx-xxxxx'. Here is my script. I add a content editor webpart and insert following lines:
<script type="text/javascript">
$(document).ready(function(){
SP.SOD.executeFunc('SP.Runtime.js', 'SP.Runtime', function () {
SP.SOD.executeFunc('SP.js', 'SP.ClientContext', function () {
SP.SOD.executeFunc('SP.Taxonomy.js', 'SP.Taxonomy', loadTerms)
});
});
});
function loadTerms(){
SP.SOD.executeFunc('sp.taxonomy.js', 'SP.Taxonomy.TaxonomySession', function () {
var termId = 'xxxxx-xxxxx-xxxxx-xxxxx-xxxxx';
console.log(termId);
getTerm(termId,printTermInfo,printError);
});
}
function printTermInfo(term)
{
console.log(String.format('Name: {0}',term.get_name()));
console.log('success');
}
function printError(sender,args){
console.log(args.get_message());
console.log('fail');
}
</script>
The problem is it return nothing. No error no console log is found. In the F12 tool I can see runtime.js and taxonomy.js is returned with http 200. I think they are loading correctly. What could be the problem?
SP.Taxonomy.js
twice? Could you share yourgetTerm
code?