Update you can register for email notifications!
Yes, thats right! I have spent a little time working on a cool Ajax-PHP-MySql email register. This way we should be able to keep track of who is interested in getting the juicey details on what it is that we are doing before the rest of the world does… perhaps even before some of our direcotrs find out!
It has taken a little of playing around with to get just right … PHP and MySql was easy enough, all we are doing is loading an email addres into a table… but I had a little to learn around using jQuery and this is what I ended up with:
/*
* Function is run when the DOM is ready.
*/
$(function() {
$("#emailform").validate({
event: "keyup",
errorLabelContainer: $("#messageBox"),
wrapper: "li",
rules: {
email: {
required: true,
//rangeLenght Option [minLenght,maxLenght]
rangeLength:[6,50],
//It is an E-Mail address
email: true
}
},
messages: {
email:
'Please enter a valid email address'
}
});
});
/*
* The submit function for our AJAX form
*/
function submitEmail(){
$.ajax({
url: 'register_ajax.php',
type: 'POST',
data: { email: $('#email').val() },
dataType: 'html',
timeout: 1000,
error: function(msg){
$('#sign_up').html('Sorry, there was a ' +
msg.status + ' error saving your email: ' +
msg.responseXML);
},
success: function(html){
$('#sign_up').html(html);
}
});
}
It is just remarkable how much is acheived with so little javascript code! The form is sent using Ajax supplied by jquery and is validated by the jquery validation plugin.












October 19th, 2007 at 8:50 am
It seems I should have tested this on Outlook as well! Ah well, it still sends an email but it isn’t formatted the way I wanted.
The AJAX implementation seems to be good, but the PHP send mail function could use a tidy up.
October 19th, 2007 at 8:51 am
BTW, sign up for yourself. We’ll have some good stuff to send you soon and we won’t send you anything unless it is good!