Services | Updates | Contact
Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML
Toby's PL/SQL Editor
The PL/SQL editor is a plugin for the eclipse integrated development environment that allows you to more easily develop
 
GotoFile
Welcome to the GotoFile Eclipse Plugin home page. The latest versions of the plugin will be made available here.
 
More Tutorials...


    Loan Information     Struts     Open Source

Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML

 
 
Ajax

 
Comments
 
 

 

Ajax Registration Program

                         

In this Ajax Registration  program you will learn  how to validate the user registration through ajax call and then display the alert massage if no values are provided in the username and password fields.

When a user input user Id and password and press Register button , method 'call_Register()'  will make ajax call. If  the value returned from the server is "yes" the alert box will show 'Welcome for Register' otherwise it will show ' the Invalid Id/password please enter the Id/password!'. 

Example of  Ajax Registration program:

<html>

      <head>

      <title>Ajax Registratiion program</title>

      <script language="javascript">

      function postRequest(strURL){

var xmlHttp;

if(window.XMLHttpRequest){ // For Mozilla, Safari, ...

var xmlHttp = new XMLHttpRequest();

}

else if(window.ActiveXObject){ // For Internet Explorer

var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");

}

xmlHttp.open('POST', strURL, true);

xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

xmlHttp.onreadystatechange = function(){

if (xmlHttp.readyState == 4){

updatepage(xmlHttp.responseText);

}

}

xmlHttp.send(strURL);

}
function updatepage(str){

if(str == "no"){

       alert("Invalid Id/password! Please fill Currect Id/password")

}
                       else{

    alert("welcome for register !");

                        }

                     }

function call_register(){

var login_id =document.reg.uid.value;

                var password=document.reg.passwd.value;

var url = "Register.php?loginid="+login_id+"&password="+password+"";

postRequest(url);



      </script>

      </head>

      <body> 

      <center>

 <form name="reg">

      <table border="1" width="30%">

      <tr>

     <td align="center" colspan="2">  <font face="Monotype" size="5">Registration</font></td>

      </tr>

      <tr>

    <td>  Login id: </td>  <td> <input type="text" name="uid"  size="20"></td>

      </tr>

 <tr> 

    <td> Password: </td><td><input type="password" name="passwd" size="20" /></td>

      </tr>

      <tr>

    <td align="center" colspan="2"> <input type="submit"  value="Register" onClick="return call_register()" 

 style="background-color:#FFE9D2;color:#0000FF; border-color:#99CC33"> </td>

      </tr>
  </table>

      </form>

      </body>
      </html>

Here this code support the Register.php for Ajax Registration program:

<?
$loginid=$_GET["loginid"];
$password=$_GET["password"];
if( $password == "" || $loginid == "" || ($loginid == "" && $password == "") ){
echo "no";
}
else{
echo "yes";
}
?>

Try the Example online

                         

Facing Programming Problem?
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

0 comments so far (post your own) View All Comments Latest 10 Comments:

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.