I have used iText to export the table contents to pdf.
Here is my code:
JSP:
<%@ page language=\"java\" contentType=\"text/html; charset=I
It's ocorring because of line $("#datatoexport").val($("#customers").html()); where the Jquery method .html retrieve the entire html from the html table. There is not easy way to extract text from a html table, you will need a parse function in jquery like in this post: Getting text from td cells with jQuery
In adiction, the sample that you post isn't the best form to request a server processing text, look in this How to use Servlets and Ajax?