Hi all
Looking into using AJAX for a new project I'm doing and found this...
...which uses some code in ajax2.asp to determine whether a username is valid (checks for length, existing username in a database etc...). Is this how everyone else does AJAX?
Looking into using AJAX for a new project I'm doing and found this...
Code:
<script type="text/javascript">
var http = false;
if(navigator.appName == "Microsoft Internet Explorer") {
http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
http = new XMLHttpRequest();
}
function validate(user) {
http.abort();
http.open("GET", "ajax2.asp?name=" + user, true);
http.onreadystatechange=function() {
if(http.readyState == 4) {
document.getElementById('foo').innerHTML = http.responseText;
}
}
http.send(null);
}
</script>
<h1>Please choose your username:</h1>
<form>
<input type="text" onkeyup="validate(this.value)" />
<div id="foo"></div>
</form>
...which uses some code in ajax2.asp to determine whether a username is valid (checks for length, existing username in a database etc...). Is this how everyone else does AJAX?