how can help me about my code ?

how can help me about my code ?

i have three page : 

index.php : 

  1. <?php 
  2. require_once("includes/funcs.class.php");
  3. $existUsername = new funcs();
  4. if(isset($_POST['username']))
  5. {
  6. $existUsername->existUsername($_POST['username']);
  7. }
  8. ?>
  9. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  10. <html xmlns="http://www.w3.org/1999/xhtml">
  11. <head>
  12. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  13. <title>Untitled Document</title>
  14. <script src="js/jquery-1.9.0.min.js" type="text/javascript"></script>
  15. <script src="js/juser.js" type="text/javascript"></script>
  16. <link rel="stylesheet" href="style.css" />
  17. </head>

  18. <body>
  19. <div class="divclass">
  20. <form action="index.php" method="post" id="login">
  21. Username : <input type="text" name="username" id="username" /><br /><br />
  22. Password : <input type="text" name="password" id="password" /><br /><br />
  23. <input type="submit" value="login" id="submitlogin" /><br /><br />
  24. </form>
  25. </div>
  26. </body>
  27. </html>
funcs.class.php : 

  1. <?php
  2. require_once("config.class.php");
  3. class funcs
  4. {
  5. protected $_dbconnect;
  6. protected $_dbusername;
  7. protected $_dbpassword;
  8. protected $_dbemail;
  9. //User's ... Functions ...
  10. function __construct()
  11. {
  12. return config::getInstance();
  13. }
  14. function existUsername($dbusername)
  15. {
  16. global $dbquery,$dbresult,$dbtable;
  17. $dbtable = "users";
  18. $this->_dbusername = $dbusername;
  19. $this->_dbconnect = config::$_dbconnect;
  20. $dbquery = $this->_dbconnect->prepare("SELECT * FROM ".$dbtable." WHERE username = :username");
  21. $dbquery->bindParam(":username",$this->_dbusername);
  22. $dbquery->execute();
  23. $dbresult = $dbquery->rowCount();
  24. if($dbresult == 1)
  25. {
  26. return true;
  27. }
  28. else
  29. {
  30. return false;
  31. }
  32. }
  33. }
  34. ?>

juser.js : 

  1. // JavaScript Document
  2. $(document).ready(function(e) {
  3. $('#username').change(function(){
  4. var existUsername = $('#username').val();
  5. jQuery.ajax({
  6. type: "POST",
  7. url: "index.php",
  8. data: existUsername,
  9. cache: false,
  10. success: function(response)
  11. {
  12. if(response)
  13. {
  14. alert("Ok . ");
  15. }
  16. if(!response)
  17. {
  18. alert("No . ");
  19. }
  20. }
  21. });
  22. });
  23. });
when i enter the username : saeed Ø� (username is not in the database) -> alert ok . 
when i enter the username : admin (username in the datdabase) ->alert ok .
 what is the problem ?