I am developing a new master page and I would like to create a coded section to add a masonry grouping of all of the subsites associated in the site collection.

I would love any advice you might offer. thx.


use this piece of code get all subsites inside a site collection:

<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>



function GetSites()
        url: _spPageContextInfo.webAbsoluteUrl + "_api/web/webs",
        type: "GET",
        headers: {
            "accept": "application/json;odata=verbose",
        success: function (data) {
//Display the results to a webpart zone or any text box
        error: function (error) {


Mark it as answer if this resolves your query. thanks!

| improve this answer | |
  • I tried the script and believe it's taking me in the right direction... however I keep returning a 404 error? Any suggestions? – lukin Jun 18 '16 at 4:26
  • press f12...go to scripts tag and find the above script...put debugger point and check.. on which point you are getting 404 error.. – Ankit Kumar Jun 20 '16 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.