First of all, the way you're trying to do that is horrendous.
The point is that we don't know what some of your functions are doing. But if it changes the signature of the servlet method you're trying to post to, then you could get an empty response back.
Just bind a function to the form's submit event:
<script type="text/javascript">
$('#form2').submit(function(){
$.ajax({
"type": "POST",
"url": "EditText.jsp",
"data": $('#form2').serialize(),
"success": function(){
//callback function
}
});
}
</script>
<form method="POST" class="example" action="/jsp/EditText.jsp" id=form2>
<input type=hidden name=filepath value="<%=filename%>"/>
<input type=hidden name=textarea value=true />
<input type=submit name=submit value="Save Changes">
<!--the second button that I am trying to make-->
<input type="button" name="submit" value="Save Changes">