    // wait for the DOM to be loaded 
    $(document).ready(function() { 
        // bind 'myForm' and provide a simple callback function 
        $('#myForm').submit(function() {
        	var options = { 
        	        target:        '#newsletter_form',   // target element(s) to be updated with server response 
        	        beforeSubmit:  validate  // pre-submit callback 
        	        //success:       showResponse  // post-submit callback 
        	 
        	        // other available options: 
        	        //url:       url         // override for form's 'action' attribute 
        	        //type:      type        // 'get' or 'post', override for form's 'method' attribute 
        	        //dataType:  null        // 'xml', 'script', or 'json' (expected server response type) 
        	        //clearForm: true        // clear all form fields after successful submit 
        	        //resetForm: true        // reset the form after successful submit 
        	 
        	        // $.ajax options can be used here too, for example: 
        	        //timeout:   3000 
        	    };  
            // submit the form 
            $(this).ajaxSubmit(options); 
            // return false to prevent normal browser submit and page navigation 
            return false; 
        });
    }); 
    
    
    function validate(formData, jqForm, options) { 
        // formData is an array of objects representing the name and value of each field 
        // that will be sent to the server;  it takes the following form: 
        // 
        // [ 
        //     { name:  username, value: valueOfUsernameInput }, 
        //     { name:  password, value: valueOfPasswordInput } 
        // ] 
        // 
        // To validate, we can examine the contents of this array to see if the 
        // username and password fields have values.  If either value evaluates 
        // to false then we return false from this method. 
     
        for (var i=0; i < formData.length; i++) { 
            if (!formData[i].value) { 
                alert('Por favor indique o seu nome e email!'); 
                return false; 
            } 
        } 
    }

