<!DOCTYPE HTML><HTML><Head><MetaCharSet= "Utf-8"><title>Untitled Document</title><Scripttype= "Text/javascript">window.onload=function(){ varFM=document.getElementsByTagName ("form")[0]; Fm.onsubmit=function() { //var Username=document.getelementbyid ("username"). Value; //var Password=document.getelementbyid ("password"). Value; //var Email=document.getelementbyid ("email"). Value; //var fmdata= "username=" +username+ "&password=" +password+ "&email=" +email; varFmdata=NewFORMDATA (FM); varXHR=NewXMLHttpRequest (); Xhr.onreadystatechange=function() { if(Xhr.readystate==4) {alert (xhr.responsetext); }} xhr.open ("POST","/1.php"); //use Formdata without setting the table header //Xhr.setrequestheader ("Content-type", "application/x-www-form-urlencoded");xhr.send (Fmdata); return false; } }</Script></Head><Body>Ajax+formdata+javascript Implementing a No-refresh form registration<formMethod= "POST">name<inputname= "username"type= "text"ID= "username"><BR>Password<inputname= "Password"type= "Password"ID= "Password"><BR>Email<inputname= "Email"type= "text"ID= "Email"><BR><inputtype= "Submit"value= "Submit"></form></Body></HTML>
Ajax+formdata+javascript Implementing a No-refresh form registration