calling a java function onClick with ajax
<script type="text/javascript"> $(document).ready(function() { $('#sendMailBtn').click(function (){ $.ajax({ type: "post", url: "/path", data: "email=" + $('#email').val() + "&subject="+$('#subject').val() + "&msg=" + $('#msg').val(), success: function(msg){ // } }); }); }); </script>