How can I format on server side so returned AJAX is formatted in the markup?

My server will return a hollow shell of an html page. In a simple example…

<html>
  <head>
    <title>end-user</title>
  </head>
  <body>
    <div id='prnt'>
    </div>
  </body>
</html>

It then does an AJAX request to return dynamic content. Again a simple example of the content…

  <div id='chld'>
    <div id='gndcld'>
      All kinds of stuff will go in here!
    </div>
  </div>

As the end-user is a developer that will take the markup and modify it for their own specialized use, I want the HTML markup to be formatted for ease of readability, with all the indentions and new lines. So the resulting markup would look something like…

<html>
  <head>
    <title>end-user</title>
  </head>
  <body>
    <div id='prnt'>
      <div id='chld'>
        <div id='gndcld'>
          All kinds of stuff will go in here!
        </div>
      </div>
    </div>
  </body>
</html>

So far I can return the content so that the browser rendering of the markup is what I want, but the markup itself is all in one line. I’ve tried various rn type combinations that either the browser doesn’t like or it simply ignores. Is this even possible? If it is significant, the server code is C++ and I’m using plain JavaScript on the browser side. The server is a microcontroller, so there is not enough room for things like jQuery or other 3rd party libraries.

Thanks for any help you can provide.