Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Saving the DOM as HTML after modification

In an Rails app I want to modify the DOM of a web page using javascript

Can I save the resulting HTML (of the whole page) after each modification to a database?

Thanks.

like image 708
Victor Avatar asked Jul 23 '10 01:07

Victor


People also ask

How do I save a modified HTML file?

After the html is appended, just press Ctrl+S to save the file locally with modified html.

What does the document write() function do?

The document. write() method writes a string of text to a document stream opened by document.

Which JavaScript method is used to write HTML output*?

The write() method writes directly to an open (HTML) document stream.

What is write() in JavaScript?

The write() method in HTML is used to write some content or JavaScript code in a Document. This method is mostly used for testing purpose. It is used to delete all the content from the HTML document and inserts the new content. It is also used to give the additional text to an output which is open by the document.


1 Answers

With jQuery you could use var html = $(document).html(); Then post the html with $.ajax() to the controller where you choose to save it.

like image 87
Keyo Avatar answered Sep 28 '22 10:09

Keyo