I'm developing a form in which user must insert an username. I want to check on blur that username of user is valid:
I added this script:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script>
IN HTML:
<input name="username" type="text" onblur="checkUsername()">
Script:
function checkUsername(){
    var usn = document.getElementsByName('username')[0];
    if(usn.value != "") {
       var html = $.ajax({
       type: "GET",
       url: "checkUsername.php?",
       data: "usr=" +usr.value 
       async: false,
       dataType: "text"}).responseText;   
       if(html == "si") {
          usn.style.backgroundColor = "green";
       } else {
          usn.style.backgroundColor = "red";
          usn.value = "Username still exists!";
       }
    }
}
So onBlur doesn't work, and when I submit form it appear an error like this:
HTTP Error 405.0 - Method Not Allowed
The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.
What can I do? Where is the problem?
 
     
     
     
     
    