HTTP Error 405.0 - Method Not Allowed using Jquery ajax get -
HTTP Error 405.0 - Method Not Allowed using Jquery ajax get -
i'm developing form in user must insert username. want check on blur username of user valid:
i added 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, , when submit form appear error this:
http error 405.0 - method not allowed page looking cannot displayed because invalid method (http verb) beingness used.
what can do? problem?
first of consider upgrading jquery 1.6.x version.
try modified version of script:
function checkusername(){ var usn = document.getelementsbyname('username')[0]; if(usn.value != "") { var html = $.ajax({ 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!"; } } }
jquery ajax http-status-code-405
Comments
Post a Comment