title: Reload a div on AJAX request
body: <p>I want to send an ajax request and reload the div from which it came. As of current I am getting the proper request but it isn't reloading the <code>div</code> - it just makes it blank (nothing there). And I have to refresh the page to see my data. How can I get it to display properly?</p>
  
  <p><em>my <code>add_amenity.php</code> page works fine</em></p>
  
  <p>*also, don't be suspicious of the <code>var id = $('.editblock').find('#id').val();</code> It gets the value it needs and sends it to <code>add_amenity.php</code> just fine. My only problem is getting the div to reload on an add.</p>
  
  <p>php and html on same page as JS below. (This is not add_amenity.php)</p>
  
  <pre><code>   &lt;div class="editunitamenities"&gt;
          &lt;?php
              require_once('config/db.php');
              $con = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
  
              $query = 'SELECT id, unit, amenities FROM amenities WHERE unit = '.mysqli_real_escape_string($con, $_GET['id']).'';
              $result = mysqli_query($con, $query);
              while ($row= mysqli_fetch_assoc($result))
              {
                  echo '&lt;div class="checkbox"&gt;&lt;input type="checkbox" id="'.$row['id'].'" checked 
                  class="amenitiescheckbox" name="'.$row['amenities'].'" value="'.$row['amenities'].'" /&gt;
                  &lt;label title="'.$row['unit'].'"&gt;'.$row['amenities'].'&lt;/label&gt;&lt;/div&gt;';
              }
              mysqli_close($con);
          ?&gt;
          &lt;div class="newamenitywrap"&gt;
              &lt;div class="button"&gt;&lt;button class="smallbutton" id="addamenity"&gt;New&lt;/button&gt;&lt;/div&gt;
              &lt;div&gt;&lt;input type="text" name="amenity" style="width:120px;" id="amenity" placeholder="Amenity Name" /&gt;&lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;  &lt;!-- end editunitamenities --&gt;
  </code></pre>
  
  <p>Here is the AJAX request</p>
  
  <pre><code>&lt;script&gt;
  $('#addamenity').click(function() {
      var id = $('.editblock').find('#id').val();     
      var amenity = $( "#amenity" ).val();
  
      var dataString ={id:id,amenity:amenity};
      console.log(dataString);    
      if (amenity != '')
      {
          $.ajax({        
              type: "POST",
              url: "classes/add_amenities.php",
              data: dataString,
              cache: false,
              async:false,
              success: function(html)
              {
                  $('.editunitamenities').html(html);
              }
          });
      }
  });
  &lt;/script&gt;
  </code></pre>