title: Ajax receiving the incorrect error from PHP
body: <p>I am attempting to set up modal for a project in which a client would be able to update their favorite team, city of birth and their size. Upon not entering some of the information I would like an error message to be returned to them but the only error message being echoed is "City was not updated as there was not new information submitted."</p>
  
  <p>the modal code is as follows:</p>
  
  <pre><code>&lt;!-- Modal --&gt;
  &lt;div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-  labelledby="myModalLabel" aria-hidden="true"&gt;
   &lt;div class="modal-dialog" role="document"&gt;
   &lt;div class="modal-content"&gt;
    &lt;div class="modal-header"&gt;
      &lt;button type="button" class="close" data-dismiss="modal" aria-label="Close"&gt;
        &lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;
        &lt;/button&gt;
       &lt;h4 class="modal-title" id="myModalLabel"&gt;Modal title&lt;/h4&gt;
      &lt;/div&gt;
       &lt;div class="modal-body"&gt;
      &lt;form&gt;
    &lt;div class="form-group"&gt;
      &lt;label for="city"&gt;You were born in:&lt;/label&gt;
     &lt;input type="text" class="form-control" id="city"  placeholder="city"&gt;
  
     &lt;/div&gt;
     &lt;div class="form-group"&gt;
     &lt;label for="favorite_team"&gt;Favorite team:&lt;/label&gt;
      &lt;input type="text" class="form-control" id="favoriteTeam"  placeholder="favorite team"&gt;
  
     &lt;/div&gt;
     &lt;div class="form-group"&gt;
     &lt;label for="size"&gt;size:&lt;/label&gt;
      &lt;input type="text" class="form-control" id="size"  placeholder="size"&gt;
  
     &lt;/div&gt;
  
      &lt;div class="alert alert-success" id="successAlert" role="alert"  style="display: none"&gt;&lt;/div&gt;
     &lt;div class="alert alert-danger" id="updateFail" style="display:none" &gt;          &lt;/div&gt;
  
      &lt;/form&gt;
      &lt;/div&gt;
       &lt;div class="modal-footer"&gt;
       &lt;button type="button" class="btn btn-secondary" data-dismiss="modal"  &gt;Close&lt;/button&gt;
       &lt;button type="button" class="btn btn-primary" id="saveBtn"  onClick="Changes()"&gt;Save changes&lt;/button&gt;
     &lt;/div&gt;
     &lt;/div&gt;
     &lt;/div&gt;
     &lt;/div&gt;
  </code></pre>
  
  <p>my ajax code is:</p>
  
  <pre><code>  function Changes(){
     $.ajax({
             type: "POST",
            url: "../php_parsers/update_parse.php",
            data: "city=" + $("#city").val() + "&amp;favoriteTeam=" +    $("#favoriteTeam").val() + "&amp;size=" + $("#size").val(),
              success: function(result) {
                if (result == "success") {
  
                  $("#successAlert").html(result).show();
  
                  } else {
  
                  $("#updateFail").html(result).show();
  
                  }
               }
  
             })
  
             }
  </code></pre>
  
  <p>my php code is update_parse.php:</p>
  
  <pre><code>&lt;?php
  // AJAX CALLS THIS UPDATE CODE TO EXECUTE
  $error = "";
  $success = "";
  if(!$_POST['city']){
  $error .= "City was not updated as there was not new information submitted.";
  } else if(!$_POST['team']){
  $error .= "Team was not updated as there was not new information submitted.";
  } else if(!$_POST['size']){
      $error.= "size was not updated as there was not new information submitted.";
      } 
  
      if($error == ""){
          echo $error;
          }else {
              $success = "update successful so far";
          echo $success;
  
  
              }
  
  
   ?&gt;
  </code></pre>
  
  <p>All feed back is welcomed.</p>