Jump to content

submit form


dwl10

Recommended Posts

Hi, im quite new to ajax, so any help would be appreciated. Im building a registration page. when all of the information has been entered into the fields I would like the form to process a php page which should produce text saying "registered" or "user ID exists".

 

my html

	<body>
<div class="header">
</div>
<p><b><h1>User Registration</h1></b></p>

<form name="register" action="RegisterNewUser.php">
	<p>User ID:
	<input type="text" name="userID" value="" onMouseMove="javascript:validate();"> <div id="user"></div></p>

	<p><br>First Name:
	<input type="text" name="Name" value="" onMouseMove="javascript:validate();"> <div id="name"></div></p>

	<p><br>Surname:
	<input type="text" name="Surname" value="" onMouseMove="javascript:validate();"> <div id="surname"></div></p>

	<p><br>Password:
	<input type="password" name="passWD" value="" onMouseMove="javascript:validate();"></p>

	<p><br>Retype Password:
	<input type="password" name="repassWD" value="" onMouseMove="javascript:validate();"><div id="password"></div></p>


	<br>

	<input type="Submit" name="Submit" value="Submit" onClick="ajax();">
	<input type="reset" name="Reset" value="Reset">


</form>


</body>

 

my javascript

	<script type="text/javascript">
function  ajax(){ 
var req;
    try{
    req = new XMLHttpRequest();
} 
catch (e){
try{
req = new ActiveXObject("Msxml2.XMLHTTP");
} 
catch (e) {
try{
req = new ActiveXObject("Microsoft.XMLHTTP");
} 
catch (e){
alert("Your browser needs updating.");
return false;
       		}
		}
	}
        req.onreadystatechange  = function()
    { 
         if(req.readyState  == 4)
         {
              if(req.status  == 200) 
                        var response=request1.responseText;

         }
    }

    req.open("GET", "RegisterNewUser.php", true);
    req.send(null);
}

 

 

 

can anyone shed any light on where im going wrong? the submit button works how I want it to, but i do not want to have to press submit.

 

thank you in advance.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.