Skip to main content
3 of 3
edited code
Dikesh Gandhi
  • 7.2k
  • 4
  • 31
  • 58

Please try below code:

var ctx;
 
 SP.SOD.executeFunc('sp.js', 'SP.ClientContext', sharePointReady);
 function sharePointReady () {

                ctx = new SP.ClientContext.get_current();
                var siteColl = ctx.get_site();
                var rootWeb = siteColl.get_rootWeb();
                this.props =  rootWeb.get_allProperties();
                ctx.load(rootWeb);
                ctx.load(this.props); //need to load the properties explicitly
                    
                ctx.executeQueryAsync(Function.createDelegate(this, gotProperty), Function.createDelegate(this, failedGettingProperty));

}
            
            
            function gotProperty() {                
                 var policy = this.props.get_item('GA_PolicyDisplayName');
                 var primarySiteContact = this.props.get_item('GA_PrimarySiteCollectionContact');
                 var secondarySiteContact = this.props.get_item('GA_SecondarySiteCollectionContact');
 
                 elem = document.getElementById('ga-sitecontact');//Pass your desired object
                 elem.innerHTML = "<b>Policy:</b> " + policy  + " <b>Primary Contact:</b> " + primarySiteContact  + " <b>Secondary Contact:</b> " + secondarySiteContact;
            }
            
            function failedGettingProperty() {
                // swallow
            }

Reference:

Hope this will help you.

Dikesh Gandhi
  • 7.2k
  • 4
  • 31
  • 58