title: AJAX: am I inserting data correctly?
body: <p>I read many of the similar threads here to see what I'm doing wrong, but my AJAX call seems correct. What am I missing here? No alert is popping up, so I assume it's the JS side.</p>
  
  <pre><code>$("#SignupSubmit").click(function()
  {
  var fName = $("#txtSignFName").val();
  var lName = $("#txtSignLName").val();
  var email = $("#txtSignEmail").val();
  var pw    = $("#txtPW").val();
  
  
  if( fName == "" || lName == "" || email == "" || pw == "" )
  {
      alert();
  }
  
  else 
  {
  
  
      $.ajax({
          type: "POST",
          url: "actionPages/signUp.php",
          dataType: 'json',
          data: {
              fName:fName,
              lName:lName,
              email:email,
              pw:pw
          },
          success: function(response) {
              alert(response);
          }
      });
  }
  });
  </code></pre>
  
  <p>And the PHP (is this correct?):</p>
  
  <pre><code>&lt;?php 
  
  require "../connectionPages/localConnect.php";
  
  $fName  = $_POST["fName"];
  $lName  = $_POST["lName"];
  $email  = $_POST["email"];
  $pw     = $_POST["pw"];
  
  if($fName == null || $lName == null || $email == null || $pw == null)
  $message = "missing required data";
  else
  {
  
  $SQL =  "INSERT INTO `customer/User` (custFName,
                              custLName,
                              custEmail,
                              custPassword)
  VALUES ('$fName', '$lName','$email', '$pw')";
  
  $mysqli-&gt;query($SQL);
  
  if($mysqli-&gt;affected_rows &gt; 0)
  {
      $message = "Record successfully inserted &lt;br&gt;&lt;a href='..'&gt;Back to Main Page&lt;/a&gt;";
  
      $SQL = $mysqli-&gt;insert_id; /* $SQL = "SELECT max(custID) as ID FROM `customer/User`"; */
      $res = $mysqli-&gt;query($SQL) or trigger_error($mysqli-&gt;error."[$SQL]");
  
      json_encode($res);
  }
  else {
      $message = "Unable to insert record: " . $mysqli-&gt;error;
  }
  $mysqli-&gt;close();
  </code></pre>
  
  <p>}</p>