I'd really like to take all of the html in a div (contains many other divs, form elements, etc), urlencode it (maybe) and then do an ajax post to a server side handler so that I can save the exact state of what the user is seeing.
I would then like to be able to take that string that I've saved in a database and send it back in response to an ajax call in the future.
Should I use something like the following?
var contents = escape($('#myDiv').html());
Then do an ajax post operation to a server side handler? Would escape ensure that I am not passing back any special characters that would mess up the ajax call?
Any pointers are appreciated.