$('button').click(function() {
// First let's show our loading message to tell the user what is happening.
$('#message').html('Making request...');
// Now we make a GET request but we tell it to make sure 500 milliseconds
// pass before the sucess function is invoked.
$.getWithTimeout(500, 'http://tomcoote.co.uk', {}, function() {
// This is then called no sooner than 500 milliseconds but possibly
// longer, if the request took longer to return, giving time for the user
// to read our message!
$('#message').html('Success!');
});
});