$(function(){
$('#ajaxBtn').click(function(){
$.ajax({
type : "POST",
url : "test.qr",
async : true,
dataType : "html",
data:{
ajaxValue:"한글",
ajaxValue2:"20"
},
success : function(data){
alert(decodeURIComponent(data));
},
error : function(xhr){
alert("error html = " + xhr.statusText)
}
});
});
});
------------------servlet----------------------------
req.setCharacterEncoding("utf-8");
String value = req.getParameter("ajaxValue");
String value2 = req.getParameter("ajaxValue2");
/*HashMap<String, String> map = new HashMap<String, String>();
map.put("value", value);
map.put("value2", value2);
*/
PrintWriter out = resp.getWriter();
out.println(URLEncoder.encode(value, "utf-8"));
out.println(URLEncoder.encode(value2, "utf-8"));
out.close();
'WebStudy' 카테고리의 다른 글
DB싱글톤 방식, ConnectionPool (0) | 2015.06.23 |
---|---|
session 에 관한 ... (0) | 2015.06.22 |
비동기 통신 JSON (0) | 2015.06.22 |
비동기 통신, AJAX - javascript (0) | 2015.06.22 |
창 열기, 부모창으로 값 전달, 자식창 닫기 (0) | 2015.06.22 |