title: POST to PHP without page refresh?
body: <p><strong>UPDATED - PLEASE HELP!!! IT DOES NOT LEAVE THE PAGE BUT IT DOES NOT POST TO THE SQL SERVER ANYMORE</strong></p>
  
  <p>I have followed multiple online forum posts to try and get the answer to this, but I keep getting the same thing. I just want to post without refreshing the page. My code is below, please let me know where I am going wrong.</p>
  
  <p>Below is the AJAX post portion (in file: edit_project_new.php):</p>
  
  <pre><code>      $(document).ready(function() {
   $("#proj_submit").click(function(event) {
          var pname=document.getElementById('pname').value;
          var p_start_date=document.getElementById('p_start_date').value;
          var con_start_date=document.getElementById('con_start_date').value;
          var con_end_date=document.getElementById('con_end_date').value;
          var p_end_date=document.getElementById('p_end_date').value;
          var IDF_room_ready=document.getElementById('IDF_room_ready').value;
          var AV_install_date=document.getElementById('AV_install_date').value;
          var Occupancy_date=document.getElementById('Occupancy_date').value;
          var PID=document.getElementById('PID').value;
  
  
          event.preventDefault();
  
              $.ajax({
              type:"POST",
              url: "edit_project_new.php?action=update_project",
              data: { 
                  name1: PID, name8: p_start_date, name9: con_start_date,
                  name10: con_end_date, name11: p_end_date, 
                  name12: IDF_room_ready,
                  name13: AV_install_date, name14: Occupancy_date },
              success: function() {
                  alert("Updated");
              }
  
  
      });
  });
  </code></pre>
  
  <p>});</p>
  
  <p>Below is the HTML table and form (in file: functions_new.php):</p>
  
  <pre><code>  &lt;form method="post" action="#"&gt;
                  &lt;input type="hidden" id="PID" name="PID" value=""&gt;
   ...
          &lt;input type="button" id="proj_submit" class="ui blue submit button right floated" value="Update"&gt;
              &lt;/form&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Below is the SQL query portion (in file: functions_new.php):</p>
  
  <pre><code>if ((isset($_GET['action'])) AND ($_GET['action'] == "update_project")) {
      $pname= $_POST['pname'];
      $PID=$_POST['PID'];
      $p_start_date=date('Y/m/d', strtotime($_POST['p_start_date']));
      $con_start_date=date('Y/m/d', strtotime($_POST['con_start_date']));
      $con_end_date=date('Y/m/d', strtotime($_POST['con_end_date']));
      $p_end_date=date('Y/m/d', strtotime($_POST['p_end_date']));
      $IDF_room_ready=date('Y/m/d', strtotime($_POST['IDF_room_ready']));
      $AV_install_date=date('Y/m/d', strtotime($_POST['AV_install_date']));
      $Occupancy_date=date('Y/m/d', strtotime($_POST['Occupancy_date']));
  
      $sql2 = str_replace("'1969/12/31'","NULL","UPDATE Project SET p_start_date='$p_start_date', con_start_date='$con_start_date',con_end_date='$con_end_date',p_end_date='$p_end_date',AV_install_date='$AV_install_date',IDF_room_ready='$IDF_room_ready',Occupancy_date='$Occupancy_date' WHERE PID='$PID'");
  
      if (mysql_query($sql2)) {
          echo "Project record updated.";
      } else {
          echo "Error: " . $sql2 . "&lt;br&gt;" . mysql_error($link);
      }
  }
  </code></pre>
  
  <p>Whenever I post, it will load a new page with just the echo "Project record updated." I feel like I'm very close but I am doing a little something wrong, so if someone could lead me in the right direction, I would greatly appreciate it.</p>