Código HTML:
<script type="text/javascript"> // prepare the form when the DOM is ready $(document).ready(function() { // bind form using ajaxForm $('#form').ajaxForm({ beforeSubmit: validate, target: '#htmlExampleTarget', // success identifies the function to invoke when the server response // has been received; here we apply a fade-in effect to the new content success: function() { $('#htmlExampleTarget').fadeIn('slow'); $('#loading').hide(); $('#writte').hide(); $('#message').val(''); } }); function validate(formData, jqForm, options) { var form = jqForm[0]; $('#loading').html('<img src="img/ajax-loader.gif">').show(); } }); </script>