title: Loading PHP includes in an AJAX called file
body: <p>I need help getting an ajax function to work properly. I have a page that does a simulated search of a person's zip code. It shows a Google map of their location and an ajax loader.gif. After a 3000 MS timeout, the ajax function is called to load more content in a <code>&lt;div id="content"&gt;&lt;/div&gt;</code></p>
  
  <p>The problem I am having is that the content that is loaded in the div doesn't seems to be getting any of the CSS styles I need and a few php includes. If I load the page that is called via the ajax function directly in the browser, everything displays fine. But when loaded in the ajax, I am missing the CSS and the PHP includes. Need someone ASAP to help me figure this out! Please respond.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>    &lt;?php 
      include($_SERVER['DOCUMENT_ROOT'] .'/inc/tokens.php');
      ?&gt;
  
      &lt;!DOCTYPE HTML&gt;
      &lt;html lang="en" xml:lang="en"&gt;
  
      &lt;!--head code--&gt;       
      &lt;head&gt;
  
      &lt;link type="text/css" rel="stylesheet" href="../css/v1.css" /&gt;
      &lt;style type="text/css"&gt;
  
      #quotebtn {
      position:relative;
      margin: 5px 0 1px 0;
      left:45px;
      float:left;
      width: 200px;
      height:50px;
      border: 0px;
      border-radius: none;
      }
  
      #form
      {
      margin: 100px;
      }
      &lt;/style&gt;
  
      &lt;!--start scripts--&gt;
      &lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.min.js"&gt;&lt;/script&gt;
      &lt;script language="javascript"&gt;
  
      function ajax_request() {
      setTimeout('load_results()', 3000);
      }
  
      function load_results(url) {
      $('#content').hide('fast');
      /*$('#content').fadeIn('normal');*/
      $('#content').slideDown('fast', function() {
      // Animation complete.
      });
      $('#content').load('page2.php #content', "",
      function(responseText, textStatus, XMLHttpRequest) {
      if(textStatus == 'error') {
      $('#content').html('&lt;p&gt;There was an error making the AJAX request&lt;/p&gt;');
      }
      }
      );
  
      }
      &lt;/script&gt;
  
      &lt;/head&gt;  
  
      &lt;body onload="ajax_request();"&gt;
  
      &lt;ul id="nav"&gt;
      &lt;li&gt;&lt;a href="page2.php"&gt;welcome&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
  
      &lt;!--form--&gt;
      &lt;div id="form"&gt;
      &lt;div id="top"&gt;&lt;img src="&lt;?php echo $imgpath;?&gt;/step1_boxtop.png" width="365px" height="100px" border="0" /&gt;&lt;/div&gt;
  
      &lt;!--content--&gt;
      &lt;div id="content"&gt;
  
      &lt;div id="page2text_1"&gt;&lt;?php echo $form_text1;?&gt;&lt;/div&gt;
      &lt;div id="loader"&gt;&lt;img src="&lt;?php echo $imgpath;?&gt;/ajax-loader.gif" width="128px" height="15px" border="0" /&gt;&lt;/div&gt;
  
      &lt;div id="gmaps"&gt;
      &lt;?php include($_SERVER['DOCUMENT_ROOT'] .'/offer/v1/gmap.php');?&gt;
      &lt;/div&gt;
  
      &lt;div id="page2text_2"&gt;&lt;?php echo $form_text2;?&gt;&lt;/div&gt;
  
      &lt;/div&gt;
      &lt;!--content--&gt;
  
      &lt;/div&gt;
      &lt;!--form--&gt;
  
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>