title: no element found error in firebug php ajax
body: <p>Hi I keep getting this error in firebug on this script "no element found" even after adding "header('Content-Type: text/plain');". Can anyone help? thanks.</p>
  
  <p>categories.php</p>
  
  <pre><code>    &lt;?php
      if(isset($_GET['1'])) {
      header('Content-Type: text/plain');
          echo &lt;&lt;&lt;HERE_DOC
      &lt;option value="1.1"&gt;Antiquities &amp;gt;&lt;/option&gt;
      &lt;option value="1.2"&gt;Architectural &amp;amp; Garden &amp;gt;&lt;/option&gt;
      &lt;option value="1.3"&gt;Asian Antiques &amp;gt;&lt;/option&gt;
      &lt;option value="1.4"&gt;Books &amp;amp; Manuscripts &amp;gt;&lt;/option&gt;
      &lt;option value="1.5"&gt;Decorative Arts &amp;gt;&lt;/option&gt;
      &lt;option value="1.6"&gt;Ethnographic &amp;gt;&lt;/option&gt;
      &lt;option value="1.7"&gt;Furniture &amp;gt;&lt;/option&gt;
      &lt;option value="1.8"&gt;Home &amp;amp; Hearth &amp;gt;&lt;/option&gt;
      &lt;option value="1.9"&gt;Linens &amp;amp; Textiles (Pre-1930) &amp;gt;&lt;/option&gt;
      &lt;option value="1.10"&gt;Maps, Atlases &amp;amp; Globes &amp;gt;&lt;/option&gt;
      &lt;option value="1.11"&gt;Maritime &amp;gt;&lt;/option&gt;
      &lt;option value="1.12"&gt;Mercantile, Trades &amp;amp; Factories &amp;gt;&lt;/option&gt;
      &lt;option value="1.13"&gt;Musical Instruments (Pre-1930) &amp;gt;&lt;/option&gt;
      &lt;option value="1.14"&gt;Periods &amp;amp; Styles &amp;gt;&lt;/option&gt;
      &lt;option value="1.15"&gt;Primitives;&lt;/option&gt;
      &lt;option value="1.16"&gt;Restoration &amp;amp; Care &amp;gt;&lt;/option&gt;
      &lt;option value="1.17"&gt;Rugs &amp;amp; Carpets &amp;gt;&lt;/option&gt;
      &lt;option value="1.18"&gt;Science &amp;amp; Medicine (Pre-1930) &amp;gt;&lt;/option&gt;
      &lt;option value="1.19"&gt;Sewing (Pre-1930) &amp;gt;&lt;/option&gt;
      &lt;option value="1.20"&gt;Silver &amp;gt;&lt;/option&gt;
      &lt;option value="1.21"&gt;Reproduction Antiques&lt;/option&gt;
      &lt;option value="1.22"&gt;Other&lt;/option&gt;
      HERE_DOC;
      }
  
      if(isset($_GET['2'])) {
      header('Content-Type: text/plain');
          echo &lt;&lt;&lt;HERE_DOC
      &lt;option value="60435"&gt;Direct from the Artist &amp;gt;&lt;/option&gt;
      &lt;option value="158658"&gt;Art from Dealers &amp;amp; Resellers &amp;gt;&lt;/option&gt;
      &lt;option value="52524"&gt;Wholesale Lots &amp;gt;&lt;/option&gt;
      HERE_DOC;
      }
  
      if(isset($_GET['3'])) {
      header('Content-Type: text/plain');
          echo &lt;&lt;&lt;HERE_DOC
      &lt;option value="60435"&gt;Direct from the Artist &amp;gt;&lt;/option&gt;
      &lt;option value="158658"&gt;Art from Dealers &amp;amp; Resellers &amp;gt;&lt;/option&gt;
      &lt;option value="52524"&gt;Wholesale Lots &amp;gt;&lt;/option&gt;
      HERE_DOC;
      }
  </code></pre>
  
  <p>post_categories.html</p>
  
  <pre><code>    &lt;!DOCTYPE HTML&gt;
      &lt;html&gt;
      &lt;head&gt;
      &lt;script type="text/javascript"&gt;
      // Initialize the object:
      var ajax = false;
  
      // Create the object...
  
      // Choose object type based upon what's supported:
      if (window.XMLHttpRequest) {
  
          // IE 7, Mozilla, Safari, Firefox, Opera, most browsers:
          ajax = new XMLHttpRequest();
  
      } else if (window.ActiveXObject) { // Older IE browsers
  
          // Create type Msxml2.XMLHTTP, if possible:
          try {
              ajax = new ActiveXObject("Msxml2.XMLHTTP");
          } catch (e1) { // Create the older type instead:
              try {
                  ajax = new ActiveXObject("Microsoft.XMLHTTP");
              } catch (e2) { }
          }
  
      }
  
      // Send an alert if the object wasn't created.
      if (!ajax) {
          alert ('Page functionality is unavailable. Update your browser.');
      }
  
      // Function that starts the Ajax process:
      function categories_chain(username) {
  
          // Confirm that the object is usable:
          if (ajax) { 
  
              // Call the PHP script.
              // Use the GET method.
              // Pass the username in the URL.
               ajax.open('get', 'categories.php?' + encodeURIComponent(username), true);
  
      // Function that handles the response:
      ajax.onreadystatechange = handle_check;
  
      // Send the request:
      ajax.send(null);
  
  
      } // End of check_username() function.
  
      // Function that handles the response from the PHP script:
      function handle_check() {
  
          // If everything's OK:
          if ( (ajax.readyState == 4) &amp;&amp; (ajax.status == 200) ) {
  
              // Assign the returned value to a document element:
              document.getElementById('div2').innerHTML = ajax.responseText;
  
          }
  
      } // End of handle_check() function.
      }
      &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
      &lt;form name="postadd"&gt;
          &lt;div id='div1'&gt;
              &lt;select name="cat1" onChange='categories_chain(cat1.options[selectedIndex].value)'&gt;
                  &lt;option value="1"&gt;Antiques &amp;gt;&lt;/option&gt;
                  &lt;option value="2"&gt;Art &amp;gt;&lt;/option&gt;
                  &lt;option value="3"&gt;Automotive &amp;gt;&lt;/option&gt;
              &lt;/select&gt;
          &lt;/div&gt;
          &lt;div id='div2'&gt;
          &lt;/div&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>