In my HTML I have this line of code:
<td>Username:</td>
<td><input type="text" size="40" id="username" name="username" /></td>
<td><input type="button" value="check" onclick="checkExistenceUsername()" /></td>
<td id="result_of_checking"></td>
How I tell to ajax that he has to take the content of the tag with id "username"?
This is javascript:
function checkExistenceUsername()
{ var xmlhttp;
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("result_of_checking").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "check_existence.php", true);
xmlhttp.send();
}