Basically, it would look like this:
Originally Posted by DanInMa
^ That way, any time the URL leading to the page contains a $_GET variable of "ajax" with a value of exactly "1" then only the page content div's inner section will be sent as response text for the AJAX to use.
//check for the AJAX flag being a value of "1" - if not marked as "ajax=1", then we need the html tag, the document head, the body tag, and any header/menu/sidebar items that precede the main content...we also need the main content div, since that wouldn't be included in the AJAX response version...
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Full Title of This Page</title>
//Now we deliver the page content, regardless of whether or not we are responding to an AJAX request...in the event of an actual flagged AJAX request this section immediately below is ALL that we will get as a response (along with the usual headers, of course)
<h1>This is the page content</h1>
//now we add all the standard footer and applicable sidebar content that comes AFTER the main content along with the closing body and html tags to any non-AJAX response...
<p>This is a footer.</p>