jquery ajax 제출 폼 action 에서 jsp 로 소결

jsp 페이지:
 
var clientTel = $("#clientTel").val();
var activityId = $("#activityId").val();
$.ajax({
type : "post",//
url : "/arweb/reserve/saveCode.action",//
data : "clientTel="+clientTel+"&activityId="+activityId ,
success: function(text){$("#randomCode").val(text);},
error: function(text) {alert(" , ID , ID");}
});
action 류:
 
HttpServletResponse res = ServletActionContext.getResponse();
res.reset();
res.setContentType("text/html;charset=utf-8");
PrintWriter pw = res.getWriter();
pw.print(random);
pw.flush();
pw.close();
pw.print(random);여기 random 은 action 이 jsp 에 전달 할 값 입 니 다.jsp 에서 success:function(text)여기 있 는 text 는 action 에서 전 달 된 값 을 받 는 것 입 니 다.

좋은 웹페이지 즐겨찾기