> Although personally I'd still use JSON; easier.

> Dave

Yep.

So a successful response could look like this:

response = {
        validEmail:true,
        emailAddress:'user@struts.apache.org'
}

and a failed response could look like this:
response = {
        validEmail:false,
        emailAddress:'user@struts.apache.org'
}

Then your post could look like this:
$.post(
        "validateEmail.do",
        {sendValue: email},
        function(data){
                if (data.validEmail) {
                        addToTable(data.emailAddress); //add email to
table
                } else {
                        displayErrorMessage("Invalid Email.  Please try
again.");
                }
        }
);

That is a very basic way of doing it.  The JSON response coming in is
very library-specific.  It appears you could be using jquery?  If that's
the case, then this should work as is as long as your set the response
header to be 'text/json'.  :)

Hope that helps,

Beez


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to