I was trying to include a jsp page into an other page by an Ajax call.
The problem is that if the page to be included has some white spaces between html elements, it will make the inlusion to fail.
For example here is my demo index.jsp:
function include() {
alert("Hello from include function.");
$.ajax({
type: "GET",
url: "Include",
success: function() {
alert("Ajax success function.");
$("#container").html("");
alert("Ajax end success function.");
}
});
}
Include
Here is the hello.jsp page to be included (no spaces between elements tags or the include will fail):
Hello from the included file.
Hello from the included file.
Hello from the included file.
And the servlet has just a do-nothing (for now) doGet method.
Does it appens the same to all of you? Is there something wrong with my code?
Is there an other working way of making the same task?