So here's what I'm trying to do. I have a form and one of the values is the Username. I want to check if that Username already exists in the database. So I set a JavaScript function as the onsubmit
for the form. In the function I have
xhttp.open("POST","AjaxTest.php",false);
xhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xhttp.send("Username=Leroy1981&Found=0");
A it directs to the right file, but I don't know how to access the data send in the send command and I still have no idea how to send the result, once the php file has checked the database for the supplied username. Username is an input type in the form, so it gets sent but I get undefined constant for Found.
Another question , how do I set the XMLHttpRequest
response in the php file? I could probably figure out how to retrieve that and just send "Found" or "Not Found", but don't know how to access it in the php file. Also it doesn't automatically return from the php file when it's done, which is how I thought this worked.