$(document).ready(function(){    
  
	//if submit button is clicked  
	$('form').submit(function () {          
	           
	  //Get the data from all the fields  
	  var message = $('input[name=message]');  
	   
	  //organize the data properly  
	  var data = 'message=' + encodeURIComponent(message.val());  
	           	           
	  //start the ajax  
	  $.ajax({  
			//this is the php file that processes the data and send mail  
	    url: "post.php",   
        
			//GET method is used  
			type: "GET",  

			//pass the data           
			data: data,       
  
			//Do not cache the page  
			cache: false,  
        
	    //success  
	    success: function(html) {                
		    //if process.php returned 1/true (send mail success)  
		    if (html) {                    
					$("#note-container").prepend(html); 
					
		    }          
		    //if process.php returned 0/false (send mail failed)  
		 		else {
					alert('Sorry, unexpected error. Please try again later.');                 
				}
	  	}  
	       
	  });  
	  
    $('#message').val("");
    
	  //cancel the submit button default behaviours  
	  return false;  
	});

});