title: 2 dropdown lists dependent on each other in php include. Need to reload only the include file not the entire page
body: <p>I have 2 simple drop down lists one dependent on the other in a php include. </p>
  
  <p>When one is selected it refreshes the page and then populates the second with the correct data, (works great). </p>
  
  <p>The problem is that it refreshes the whole page instead of just the include file. </p>
  
  <p>Is there a way to do just refresh the include? I have looked at many other examples (Ajax, Javascript etc) on here and other sites and cannot seem to get it to work. </p>
  
  <p>A huge thank you in advance to anyone who can point me in the right direction.</p>
  
  <pre><code>&lt;form enctype="multipart/form-data" action="advanced_search2.php" method="POST"&gt;
  
  &lt;?php require 'config.php'; ?&gt;
  
  &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;?
  echo '&lt;div id="publication"&gt;';
  
  echo "&lt;select name='cat'&gt;&lt;option value=''&gt;Select one&lt;/option&gt;";
  $quer2="SELECT DISTINCT id,publication FROM publication WHERE appear = 'Yes' and Search = 'Yes'"; 
  foreach ($dbo-&gt;query($quer2) as $noticia2) {
  echo "&lt;option selected value='$noticia2[publication]'&gt;$noticia2[publication]&lt;/option&gt;"." &lt;BR&gt;";
  }
  echo "&lt;/select&gt;";
  
  echo '&lt;/div&gt;';
  ?&gt;
  
  
  &lt;?
  echo '&lt;div id="section"&gt;';
  
  echo "&lt;select name='subcat'&gt;&lt;option value=''&gt;Select one&lt;/option&gt;";
  
  $quer="SELECT DISTINCT section FROM sandbox WHERE publication = '$cat' AND appear = 'Yes'";
  
  foreach ($dbo-&gt;query($quer) as $noticia) {
  echo  "&lt;option value='$noticia[section]'&gt;$noticia[section]&lt;/option&gt;";
  }
  echo "&lt;/select&gt;";
  
  echo '&lt;/div&gt;';
  
  ?&gt;
  
  &lt;form&gt;
  
   &lt;script&gt;
   $('#publication').change(function(){
     var page = $( this ).attr('data-page');
      $.ajax({
      type:'POST',
      url:page,
      success: function(response){
          $('#section').html(response);
      }
    });
  })
  &lt;/script&gt;
  </code></pre>