ECMA Script : To get only the specified properties of the web site in SharePoint 2010

 

<script language="ecmascript" type="text/ecmascript">

 

 

    var clientContext = null;

    var web = null;

 

    function getWebProperties() {

 

        clientContext = new SP.ClientContext.get_current();

        web = clientContext.get_web();

        clientContext.load(web, 'Title', 'Description');

        clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));

    }

 

    function onQuerySucceeded() {

 

        var message = "Web retrieved:";

        message += "\n Title: " + web.get_title();

        message += "\n Description: " + web.get_description();

        alert(message);

    }

 

 

    function onQueryFailed(sender, args) {

        alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());

    }
</script>


<
input id="btnGetWebProperties" onclick="getWebProperties()" type="button" value="Get the web properties"/>