I have created simple JavaScript code to activate the feature.
function activateFeature() {
$.ajax({
url: _spPageContextInfo.siteAbsoluteUrl + "/_api/web/features/add('7e2e2482-9007-4db3-8a7f-9bccd986ec4e')",
type: "POST",
headers: {
"Accept": "application/json;odata=verbose", //return data format.
"X-RequestDigest": $("#__REQUESTDIGEST").val()
},
success: function (data) {
// perform operation on the response object.
},
error: function (err) {
alert("Error: " + JSON.stringify(err));
}
});
}
Change the URI, and the feature will be activated based on the endpoint.
- /web - then feature will be activated at the web level.
- /site - then feature will be activated at the site collection level.
Now pass the feature GUID into the add method. You can get the GUID value by using the PowerShell command or by "SharePoint Manager 2013".
🚀 "Happy Coding" 🚀