title: Jquery Ajax PHP - How to determine if the PHP code executed successfully?
body: <p>So this is my idea, I have a login jquery dialog on my homepage that blocks anyone from using the webpage (behind the login form dialog). I use ajax to submit the information entered to a php page which then checks if the username/password combo exists in the database. If it does, I return true and then close the dialog box (allowing access to the site).</p>
  
  <p>How do I use ajax to check if my php script (from the executed page) returns true or false?
  I was assuming the success/error options of the ajax function were checking this, but the below code doesnt seem to work.</p>
  
  <pre><code>    $('.login').dialog({
      closeOnEscape: false,
      title: false,
      modal: true,
      width: 'auto',
      show: {effect: "fade", duration: 1500},
      title: 'Login',
      buttons: {
          "Login": function() { 
              $.ajax({
                  async: false,
                  type: 'POST',
                  url: 'sql/login.php',
                  success: function(){
                      alert( "Success!");
                  },
                  error: function(){
                      alert( "Failed!" );
                  },
                  dataType: "html"
              });
          }
      }
  });
  $(".login").dialog().parents(".ui-dialog").find(".ui-dialog-titlebar").remove(); 
  </code></pre>