i want to foward or redirect a page after a $.ajax call
$(document).ready(function(){
$('#submit').on('click', function(){
var params = "";
$('#tableResultat > tbody > tr').each(function(){
$parent = $(this);
params += $parent.find('td:eq(0)').attr('id') + "," + $parent.find('td:eq(0)').text() + "," + $parent.find('td:eq(1)').text() + "," + $parent.find('td:eq(2)').text() +','+ $parent.find('td:eq(3)').text() +"|";
});
$.ajax({
type: 'POST',
url: '/resultat',
data:{
parametres : params
}
});
});
});
and on my server side i have this :
protected void doPost(HttpServletRequest req, HttpServletResponse resp)throws ServletException, IOException
{
String action = req.getServletPath();
if(action.equals("/resultat"))
{
String params = req.getParameter("parametres");
//save these value in DB
req.getRequestDispatcher("WEB-INF/vues/resultat.jsp").forward(req, resp);
return;
}
}
I don't understand why when i click on my button it doesn't forward me to the resultat.jsp page ? what am i doing wrong ?
thanks for your awsers