Not sure if this is exactly what you are looking for, but I will share common trick I use...
I have done this, but did not really "remove" everything from the page, but rather "hide" from the user so that I only display what I want the user to see. An example is where I often use the new item form to create an item in a list through an iframe without
having the user leave the "current page".... I do this by following these steps:
- Using jQuery UI, create a new Dialog, and insert a (hidden) iframe that points to the newItem.aspx page.
- Using jQuery, "reach into" the iframe (because it is from the same domain, you can do this) and hide everything except the input form.
- Display the iframe to the user
Here is some sample code from an upload widget I have where it display the Edit form when a file requires "check in":
This hides all elements inside the <form> and adds a class to them (wasVisible) case we need to make them visible again... it then finds the form by first finding the "Title" field and then "walking up" to the web-part that holds it and moves that
to the root the <form>, so that it becomes accessible to the user. I then make the <form> visible to the user.
From a user experience, they see a dialog with the New Form. I have other code to "Detect" that the use made a save and then hide the dialog again, which you implement yourself.
Hope I did not loose you here... Its not the cleanest implementation, but it works for me.