I have some list "SiteInformation". In this list there is always 1 list item. In this list item there is a managed metadata column.
I would like to create some script editor webpart. Inside this webpart I would like to show the managed metadata values (multiple). How to do this?
For now I have this logic to get the title. The next step is to get managed metadata values from 1 column "Countries":
getSiteTitle = function(requestUrl, success, fail){
$.ajax({
url: requestUrl,
method: "GET",
headers: { "Accept": "application/json; odata=verbose" },
success: function (data) {
success(data);
},
error: function (data) {
fail(data);
}
});
}
$(document).ready(function() {
var url = _spPageContextInfo.webAbsoluteUrl + "/_api/web/Lists/getByTitle('SiteInformation')?$top=1&$select=Title&$orderby=ID";
getSiteTitle(url, function(data) {
var title = "";
var results = data.d.results;
if(results != null && results.length > 0) {
title = results[0].Title;
}
//logic to update title in your container
}, function(error) {
alert("Failed to load title");
}
});