Can you explain why you feel it is important to hide your source code? We might then be able to offer a better solution.
Relying on JavaScript to insert page content is a really bad idea, IMHO. Not only is it frustrating for those who may have it disabled by default, but JavaScript may fail to load for various reasons, and your page with it.
https://kryogenix.org/code/browser/everyonehasjs.html
You also need to ensure your efforts to obfuscate don’t also prevent search engines accessing and crawling the page - unless, of course, you don’t want it indexed in the first place.