I am calling the servlet this way, in the javascript file:
$(document).ready(function () {
$("#idButton").click(function() {
var p1 = "hi";
$.post("myservlet",{p1:p1});
});
});
The doPost() method code in the servlet is:
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
response.sendRedirect("second.jsp");
}
Debugging with firefox, the call $.post() can be seen. And just after that continuing execution, it also stops debugging within the netbeans in a breakpoint set on the sendRedirect() line.
I even can see that the sendRedirect() is executed, but nothing happens on the firefox browser.
What am I doing wrong? Help will be fully appreciated.