반응형

<<<<보내는 쪽>>>> jquery(.jsp)

 

var emp_name = encodeURIComponent($("#q_emp_name").val());
 var emp_id = $("#q_emp_id").val();
 var personal_area = $("#q_personal_area").val();

 if(emp_id == "" && emp_name==""){
  alert("Please fill in Employee ID, or Name.");
  return;
 }
 
 $.ajax({
        type: 'post',
        async: true,
        url: "./ajax_employee_search.jsp",
        data: "emp_name="+emp_name+"&emp_id="+emp_id+"&personal_area="+personal_area,
        success: function(data) {
            $("#search_table").empty();
            $("#search_table").append(data);
        },
        error: function(data, status, err) {
            console.log("error forward : "+data);
            alert('Search Fail');
        },
    }); 

 

 

<<<<<받는 쪽>>>> java 파일

<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%
     response.setCharacterEncoding("utf-8");
     response.setContentType("text/html; charset=utf-8");

 

String emp_name = request.getParameter("emp_name")

out.println(emp_name);

%>

 

 

반응형

WRITTEN BY
데르벨준

,