I am trying to make an AJAX call to my servlet but it doesn't work. I can't redirect to a JSP.
This is my AJAX call:
$.ajax({
url: '/register',
type: 'GET'
});
This is my Servlet:
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
getServletContext().getRequestDispatcher("/prueba.jsp").forward(req, resp);
}
If I use resp.sendRedirect("prueba.jsp")
, it does not work, but if I use my browser and put "localhost:8888/register" it works fine!
Please help!