Facebox and PHP form validation

Facebox and PHP form validation

Hi

Was wondering if anyone can help me out here. I am trying to use a Form in facebox and validate it with a PHP script.

So basically, someone submits empty fields and the form submits to php and php sends back an error that show's up in the facebox window.

I know there is jquery form validation plugin but I need to use server-side validation.

Loading form in facebox works great. Its just the php validation, that's causing me problems, below is my code and was wondering if someone can help me out.

form.php
<script language="javascript">

$(document).ready(function()
{
   $("#login_form").submit(function()
   {
      $("#msgbox").removeClass().addClass('messagebox').text('Validating....').fadeIn(1000);
      $.get("ajax_login.php",{ user_name:$('#username').val(),password:$('#password').val(),rand:Math.random() } ,function(data)
        {
        if(data=='yes') //if correct login detail
        {
           $("#msgbox").fadeTo(200,0.1,function()  //start fading the messagebox
         {
           $(this).html('Logging in.....').addClass('messageboxok').fadeTo(900,1,
              function()
           {
             document.location='secure.php';
           });
         });
        }
        else
        {
           $("#msgbox").fadeTo(200,0.1,function()
         {
           $(this).html('Your login detail sucks...').addClass('messageboxerror').fadeTo(900,1);
         });      
          }
            
        });
      return false;
   });
   $("#password").blur(function()
   {
      $("#login_form").trigger('submit');
   });
});
</script>

    <form method="get" action="ajax_login.php" id="login_form">
        <div>
           User Name : <input name="username" type="text" id="username" value="" maxlength="20" />
        </div>
        <div style="margin-top:5px">
           Password :
            &nbsp;&nbsp;
            <input name="password" type="password" id="password" value="" maxlength="20" />   
        </div>
        <input name="Submit" type="submit" id="submit" value="Login">   
    </form>



ajax_login.php
<?php
    $name = $_GET['username'];
    $pass = $_GET['password'];
   
    if(empty($name) OR empty($pass))
    {
        echo "no";
    }
    else
    {
        echo "yes";
    }
?>


PS - I am newbie at javascript/jquery/php.