Home arrow XML arrow Page 3 - Take AJAX to your Email Inbox: Developing the Client-side Application Layer

Take AJAX to your Email Inbox: Developing the Client-side Application Layer

Welcome to part two of the series “Take AJAX to your email inbox.” If the article’s title doesn’t ring any bells for you, let me tell you that this tutorial series goes through the making of a simple web-based POP3 client, which uses AJAX for pulling out email messages from a given mail server, and displays them right on a web page.

Author Info:
By: Alejandro Gervasio
Rating: 5 stars5 stars5 stars5 stars5 stars / 16
April 05, 2006
  1. · Take AJAX to your Email Inbox: Developing the Client-side Application Layer
  2. · Connecting to the mail server: defining the "sendHttpRequest()" function
  3. · Collecting connection data: defining the "getFormValues()" function
  4. · Displaying email messages: defining the "fetchMessages()" function
  5. · Initializing the POP3 client: defining the "initializeUserPanel()" function
  6. · Integrating the POP 3 client: listing the complete source code of the application

print this article

Take AJAX to your Email Inbox: Developing the Client-side Application Layer - Collecting connection data: defining the "getFormValues()" function
(Page 3 of 6 )

As I described above, all the "getFormValues()" function does is get the values entered by the user when trying to establish a connection to the mail server. In plain English this means obtaining the name or IP address of the mail server, along with the corresponding username/password combination, to be transmitted in the form var1=value1&var2=value2...&varN=valueN.

As you know, this is really a simple task to do, so the signature for the function is the following:

function getFormValues(fobj){
    var str='';
    for(var i=0;i< fobj.elements.length;i++){
        str+=fobj.elements[i].name+'='+ escape(fobj.elements
    return str;

Here, the above function accepts the web form to be processed as the one input argument and loops over its fields, in order to get the values in question. After the iteration process on the form has been performed, the function returns the form values, as an appropriately formatted string, to the calling code. Simple and sweet.

At this stage, I've demonstrated how the POP3 client can connect to the mail server, after submitting the correct data combination. However, assuming that the connection was successfully established...how are the email messages displayed on the web page? To answer this question, I'll define another useful function, which I called "fetchMessages()," tasked with showing messages retrieved from the mail server.

Let's jump to the next section and see how this function works.

blog comments powered by Disqus

- Open XML Finally Supported by MS Office
- XML Features Added to Two Systems
- Using Regions with XSL Formatting Objects
- Using XSL Formatting Objects
- More Schematron Features
- Schematron Patterns and Validation
- Using Schematron
- Datatypes and More in RELAX NG
- Providing Options in RELAX NG
- An Introduction to RELAX NG
- Path, Predicates, and XQuery
- Using Predicates with XQuery
- Navigating Input Documents Using Paths
- XML Basics
- Introduction to XPath

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials