IT 소식

 

 

 

 

datatype : 'local' 로 설정후에 ajax 를 실행하면 데이터를 불러온다

 

 

'프로그래밍 > Grid 공통' 카테고리의 다른 글

JqGrid Json 데이터 불러오기  (0) 2018.02.12

 

 
	@RequestMapping(value = "/test6.do", method = RequestMethod.POST)
	@ResponseBody
	public String test6(){
		
		JSONObject jsonObject = new JSONObject();
		JSONArray listData = new JSONArray();
		JSONObject listInfo = new JSONObject();

		// 정보 입력
		listInfo.put("SEQ", "송강호");
		listInfo.put("TITLE", "남자");
		listInfo.put("INSERT_TIME", "25");
		listInfo.put("INSERT_ID", "남궁민수");
		listInfo.put("READ_COUNT", "1");
		// Array에 입력
		listData.add(listInfo);

		listInfo = new JSONObject();
		listInfo.put("SEQ", "송강호");
		listInfo.put("TITLE", "남자");
		listInfo.put("INSERT_TIME", "25");
		listInfo.put("INSERT_ID", "남궁민수");
		listInfo.put("READ_COUNT", "1");
		listData.add(listInfo);

		// 전체의 JSONObject에 사람이란 name으로 JSON의 정보로 구성된 Array의 value를 입력
		jsonObject.put("page", "1");
		jsonObject.put("total", "2");
		jsonObject.put("listData", listData);

		String jsonInfo = jsonObject.toString();
		System.out.println("jsonInfo:" + jsonInfo);

		return jsonInfo;
	}

 

 

'프로그래밍 > Grid 공통' 카테고리의 다른 글

JqGrid Ajax 데이터 불러오기  (0) 2018.02.13

 

 

 
	
축구: 야구: 농구:
 
function goAjax6(){
	
	var checkValues = new Array();
	$("input[name='type']:checked").each(function(){
		checkValues.push($(this).val());
	});
	
	var data = {"userId": $("#userId").val(), "userPass":$("#userPass").val(), "type":checkValues }; 
	
 	$.ajax({
		type: "POST",
		url : "",
		data : JSON.stringify(data),
		dataType: "json",
		contentType:"application/json;charset=UTF-8",
		async: false,
		success : function(data, status, xhr) {
			console.log(data);
		},
		error: function(jqXHR, textStatus, errorThrown) {
			alert("error= " + errorThrown);
		}
	});
}
 

	/**
	 * @param JSON 데이터 받기
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/goAjax6.do", method = RequestMethod.POST)
	@ResponseBody
	public Map goAjax3(@RequestBody String param) throws Exception{
		
		JSONObject json = JSONObject.fromObject(param);
		System.out.println("userId:"+json.get("userId"));
		System.out.println("userPass:"+json.get("userPass"));
		System.out.println("type:"+json.get("type"));
		
		JSONArray array = (JSONArray) json.get("type");
		for(int i=0; i map = new HashMap();
		map.put("AA", "1");
		map.put("BB", "2");
		return map;
	}

'프로그래밍 > Spring' 카테고리의 다른 글

Ajax JSON Map 타입으로 넘기고 받기  (0) 2018.01.30
전자정부 프레임워크 Ajax 설정  (0) 2018.01.09
Spring properties 설정방법  (0) 2017.10.26