title: jquery.ajax() processData - set to false, still appending form data to url - and other problems
body: <p>So i am attempting to learn some jquery to use in a form to access a mysql database, here is the form:</p>
  
  <pre><code>&lt;form class="loginform" id="loginform" name="loginform"&gt;
      &lt;input type="email" id="login" name="login" placeholder="Login..." autofocus required /&gt;&lt;br/&gt;
      &lt;input type="password" id="password" name="password" placeholder="Password..." required /&gt;&lt;br/&gt;
      &lt;input type="submit" id="loginsubmit" name="loginsubmit" value="LOGIN"/&gt;&lt;br/&gt;
      &lt;input type="submit" id="register" name="register" value="REGISTER"/&gt;&lt;br/&gt;
  &lt;/form&gt;&lt;!-- end loginform --&gt;
  </code></pre>
  
  <p>I have a JS function and am using the <code>$.submit()</code> function and through the function defined as the parameter for <code>$.submit()</code> i have a call to <code>$.ajax()</code> like so:</p>
  
  <pre><code>function validateLogin(){
    $('#loginform').submit(function() {      
      $.ajax({
        url: "./validateLogin.php", 
        processData: false,
        data: {
          login: $("#login").val(), 
          password: $("#password").val()
        }, 
        success: function (result){
          alert($('#login').val());
          alert(result);
        }
      });
    });
  }
  </code></pre>
  
  <p>notice the line that reads <code>processData: false,</code>
  and finally here is the php script that is called by the <code>$.ajax()</code> method in the url setting:</p>
  
  <pre><code>&lt;?php
  $verified = FALSE;
  $login = $_POST["login"];
  $password = $_POST["password"];
  
  $con = mysql_connect(host, user, pass) or die(mysql_error());
  mysql_select_db(db, $con) or die(mysql_error());
  
  $result = mysql_query("SELECT * FROM logins") or die(mysql_error());
  while ($row = mysql_fetch_array($result)) {
    if ($row[login] == $login) {
      $verified = TRUE;
    }
  }
  ?&gt;
  
  &lt;html&gt;
      &lt;body&gt;
          &lt;?php echo($verified); ?&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>There are a few things not working, I can't get anything to happen with the exception of the form data being appended to the url( the url will look something like this after submitting: <code>http://localhost/index.htmlqlogin=aloginname&amp;password=apassword&amp;login=LOGIN</code>, it is also adding the name: value pair for my submit button to the query string for some reason), and it is my understanding from reading <a href="http://api.jquery.com/jQuery.ajax/" rel="nofollow">HERE (see the data setting)</a> that with <code>processData: false</code> this shouldn't even be happening.</p>
  
  <p>Also I can't get the <code>success: function()</code> to fire the alerts (i have also tried throwing an alert in <code>beforeSend: function()</code> and that won't fire either.</p>
  
  <p>I kinda understand jQuery but not entirely a i'm relatively new to it, but what i understand about the code i've written is that in the JS function i'm attaching an event handler to the form(? - not an element of the form), and in the function that that event handler will execute i am making a call to the <code>$.ajax()</code> method, that sends the data to a url and on successful completion of that processes the function defined in the <code>success:</code> setting of the <code>$.ajax()</code> method. then in my php script i am connecting to mysql, querying it, checking to see if the login from the form matches an entry in the db, if it does a boolean is changed to true and finally the value of the boolean is echoed inside a <code>&lt;html&gt;</code> tag, however i'm not sure about how to display that html data.</p>
  
  <p>so thats my problem in a nutshell. any guidance would be greatly appreciated!
  feel free to correct me if i am misunderstanding anything about the process as described above. thanks again.</p>