I'm looking for a way to retrieve the entire content of a webpage using JavaScript and then send it to a server script for saving. This action should be triggered after the user has made some changes to the page using AJAX and other JavaScript tools. I don't need the state of specific elements, just everything inside the body tag. I've attempted using getElementById but encountered issues with the page going into a loop and crashing.
Any suggestions would be greatly appreciated!