![]() Join Up! 96817 members and counting! |
|
|||
Using XML: A PHP Developer's Primer, Part 2
Adam Delves
Verifying the Email Address
Verification follows a similar
pattern to validation. There is
verifyAddress function which is executed when the Verify button is
clicked and the verifiyCallback function which is executed when the
server responds with a context of 'verify'.
Javascript: function verifyAddress()
The verifyCallback function
checks for
successful verification. If
verification succeeded, the verify button's text is changed to
“verified”, disabled and the submit
button is enabled. It
also clears the email input box. This means that when the form is
submitted, only the email ID is passed to the receiving script and not
the email address. The email ID can then be used by the script which
processes the form data to check the address has been verified--if it
has, it need not be verified again.
Javascript: function verifyCallback(response)
Putting it All Together
Congratulations, you now have a
working Ajax application which validates emails. You should have the
following four files in the same directory:
email_validate.php email_validator.php ajax_validation_engine.js ajax_form.html ![]() The three files required for this application are also included in the ZIP file. Extending this Example
To keep the application simple, we have omitted some details which would
be advisable to implement in a real world scenario:
Sites Which use Ajax
Below is a small taste of the many web sites with
applications which use Ajax. This list is likely only to grow. So be
one of the first web developers to jump on the Ajax bandwagon!
|