ajax 간단한 테스트 작업
ajax 간단한 테스트 작업
ajax 간단한 테스트 작업
아이작 호출부
<!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>Ajax 간단 테스트</title>
<script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script type="text/javascript" language="javascript">
function id_addr(tt,gubun) {
$(document).ready(function(){
$.ajax({
type : "POST",
url : "ajaxData.html",
data: "uid="+tt+"&gubun="+gubun,
dataType : "text",
error : function(){
alert('통신실패!!');
},
success : function(data){
alert("통신데이터 값 : " + data) ;
$("#dataArea").html(data) ;
}
});
});
}
</script>
</head>
<body>
<div id="dataArea"></div>
<a href="#" onclick="id_addr('kangwondo','tel');">kangwondo(전번)</a> <a href="#" onclick="id_addr('kangwondo','addr');">kangwondo(주소)</a>
</body>
</html>
아이작 출력부
<?
include "../init.inc";
$sql="select * from member where user_id='$uid'";
$res=mysql_query($sql);
$row=mysql_fetch_array($res);
$tel = iconv( "EUC-KR","UTF-8", $row[handphone]);
$addr =iconv( "EUC-KR","UTF-8", $row[addr]);
if($gubun=="tel") {
echo $tel;
}
else if($gubun=="addr") {
echo $addr;
}
?>