Click here to Skip to main content
Click here to Skip to main content

Debugging AJAX using Javascript - Trick

, 11 Mar 2010
Rate this:
Please Sign up or sign in to vote.
How to review dynamic HTML content from browser using JavaScript?These days everybody is using AJAX for web development. Sometimes we need to debug our AJAX code to review what actually get rendered in the browser. The problem is, if you view source code of the page, it will not display...

How to review dynamic HTML content from browser using JavaScript?

 
These days everybody is using AJAX for web development. Sometimes we need to debug our AJAX code to review what actually get rendered in the browser. The problem is, if you view source code of the page, it will not display Dynamic HTML content.
 
I have a quick trick to get Dynamic HTML content from a rendered HTML page, directly from the Browser. This is very useful when you need to trace an issue on live website.
JAVASCRIPT: alert(document.body.innerHTML);
All you need to do is to copy the code written above and paste in the URL box of Browser where you website page is opened and press Enter. It will show whole document content(dynamic) in an alert.
 
To get the Dynamic HTML content on the page itself, use this code:
JAVASCRIPT: document.write(document.body.innerHTML);
You can write your own JavaScript logic and run this way to get result according to your requirement.
 
All the Best!! Thumbs Up | :thumbsup:

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Sumit Garg From Chandigarh
Technical Lead AuthorGen Technologies
India India
No Biography provided

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 12 Mar 2010
Article Copyright 2010 by Sumit Garg From Chandigarh
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid