我想在 $.ajax 调用后转发或重定向页面
$(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
}
});
});
});
在我的服务器端我有这个:
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;
}
}
我不明白为什么当我单击按钮时它没有将我转发到 resultat.jsp 页面?我究竟做错了什么 ?
谢谢你的 awsers