DEVELOPE/jquery
jQuery Ajax 사용법
소찾나
2017. 10. 28. 10:36
jQuery Ajax 사용법
jQuery Ajax 사용법
Ajax
기존의 웹 브라우저는 서버로부터 페이지 단위로 받고 처리가 되었지만 간단한 작업을 위해 페이지 전체를 로딩할 필
요없이 xml 파일 조각 단위로 데이터를 받아 처리할 수 있기 때문에 전체 페이지를 다시 로드하지 않아도 되어 불필요
한 페이지 로딩이 필요 없을 뿐만 아니라 엑티브한 페이지 구성을 할 수 있어 유용하게 쓰이는 기술이다.
사용법방 테스트 작업
1 LIKE 연산자의 피해야할 형식
아이작 호출부
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | <!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(주소)</a> </body> | cs |
1 아이작 출력부
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | <? 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; } ?> | cs |
이글이 도움이 되셨다면 아래에 로그인이 필요없는 공감 버튼을 클릭해주세요 ^^