> Although personally I'd still use JSON; easier.
> Dave
Yep.
So a successful response could look like this:
response = {
validEmail:true,
emailAddress:'[email protected]'
}
and a failed response could look like this:
response = {
validEmail:false,
emailAddress:'[email protected]'
}
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: [email protected]
For additional commands, e-mail: [email protected]