<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>json 파싱 결과</title>
<script type="text/javascript">
window.onload = function (){
loadJSONDoc('json.action');
};
function loadJSONDoc(url){
if (window.XMLHttpRequest) {
xmlhttp=new XMLHttpRequest();
} else {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET",url,true);
xmlhttp.send();
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
xmlDoc=xmlhttp.responseText;
var ar = JSON.parse(xmlDoc);
var output="<ul id=goods>"
for(var i=0; i<ar.length; i++){
output +="<li>상품명:" + ar[i].title + " 원산지:"+ ar[i].manufacture+ " 가격:" + ar[i].price +"</li>";
}
output+="</ul>"
document.body.innerHTML += output;
}
};
}
</script>
</head>
<body>
dddd
</body>
</html>
'Web개발 > JSP, Web' 카테고리의 다른 글
[JSP] javaseript 사용하기1 (0) | 2014.11.18 |
---|---|
[html / CSS] 사용하기 (0) | 2014.11.18 |
[JSP] Mysql 과 jsp 파일로 접속하기 (0) | 2014.11.18 |
[Mobile Web] Accordion (0) | 2014.11.18 |
[Mobile Web] Jquery Mobile1 (0) | 2014.11.18 |