cool_techie Posted November 24, 2010 Share Posted November 24, 2010 Hello sir, I am working on ajax..and i m new to it....so my script is not working properly.......my ajax script is as under: <html> <head> <title>Using ajax</title> <script language="javascript" type="text/javascript"> var request = false; try { request = new XMLHttpRequest();alert("object created"); } catch (trymicrosoft) { try { request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (othermicrosoft) { try { request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (failed) { request = false; } } } if (!request) alert("Error initializing XMLHttpRequest!"); function process() { var name = document.getElementById("name").value; var password=document.getElementById("passwd").value; alert(name); var url = "process-form.php?name=" + escape(name); request.open("GET", url, true); request.onreadystatechange = updatePage; request.send(null); } function updatePage() { alert("Server is done!"); } </script> </head> <body> <h2><p align="center">Please fill the form</p></h2> <form align="center" method="GET"> Name: <input type="text" name="name" onChange="process();"/><br/> Password: <input type="password" name="passwd"/><br/> </form> </body> </html> and my php script is: <html> <head><title>form</title> </head> <body> <?php $connection=mysql_connect("localhost","root",""); if(!$connection) { die('unable to connect '.mysql_error()); } echo"$name<br/>"; ?> </body> </html> only it is popping an alert box.....that says "object created" then after pressing enter...it again shows the form pls help me out here.. Quote Link to comment https://forums.phpfreaks.com/topic/219724-ajax-help/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.