Question: function validateUname(uname) { var xhttp; if (uname != ) { xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status ==
function validateUname(uname) {
var xhttp;
if (uname != "") {
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var res = this.responseText;
}
};
xhttp.open("GET", "validuname.php?uname=" + uname, true);
xhttp.send();
}
}
Please Write a php page to handle the Ajax request. The page should be named appropriately so it can be called by the server.
The page validates emails by checking if the emails have been used by other registered users.
And re-write the JavaScript code to make the AJAX interaction work as expected.
Please help me directly provide the code screenshot, thank you!
Assume that all registered users are stored in a local MySQL database with the following parameters:
server: localhost;
database: mydb;
username: me;
password: myPa$$#;
table: tabUser;
username field: username.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
