웹개발 교육/jQuery

[44일] jQuery (16) - Ajax

2022. 9. 28. 17:58

Ajax는 Asynchronous JavaScript and XML의 약자로 빠르게 동작하는 동적인 웹 페이지를 만들기 위한 개발 기법의 하나이다.

 

Ajax는 웹 페이지 전체를 다시 로딩하지 않고도, 웹 페이지의 일부분만을 갱신할 수 있다.

즉 Ajax를 이용하면 백그라운드 영역에서 서버와 통신하여, 그 결과를 웹 페이지의 일부분에만 표시할 수 있다.

 

서버와는 다음과 같은 다양한 형태의 데이터를 주고받을 수 있다.

  • JSON
  • XML
  • HTML
  • 텍스트 파일 등

 

http://www.tcpschool.com/ajax/ajax_intro_basic

 

코딩교육 티씨피스쿨

4차산업혁명, 코딩교육, 소프트웨어교육, 코딩기초, SW코딩, 기초코딩부터 자바 파이썬 등

tcpschool.com

 

 

<!DOCTYPE html>
<html lang="ko">
    <head>
        <meta charset="UTF-8">
        <title>17_ajax.html</title>
        <script src="jquery-3.6.1.min.js"></script>
    </head>  
    <body>

        <button>* JSON 데이터 받아오기 *</button>

        <script>
            $("button").click(function(){
                $.ajax("actors.json", {
                    dataType:"json"
                    ,error:function(xhr, status, error){
                        alert("ERROR!!");
                        alert(xhr);     //XMLHttpRequest 객체
                        alert(status);  //응답 상황
                        alert(error);   //Not Found
                    }
                    ,success:function(result, status, xhr){
                        alert("SUCCESS!!");
                        alert(result); //서버가 응답해준 객체 형태의 메시지
                        alert(status); //응답 상황
                        alert(xhr);    //XMLHttpRequest 객체
                    }
                });//ajax() end
            });//click end
        </script>
        
    </body>
</html>

에러 발생 시

 

성공 시

 

 

 

https://www.w3schools.com/jquery/ajax_ajax.asp

 

jQuery ajax() Method

W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

www.w3schools.com

https://www.w3schools.com/js/js_ajax_http.asp

 

AJAX The XMLHttpRequest Object

W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

www.w3schools.com

 

'웹개발 교육 > jQuery' 카테고리의 다른 글

[44일] jQuery (17) - Ajax  (0) 2022.09.28
[44일] jQuery (15) - 스크롤 이동  (0) 2022.09.28
[44일] jQuery (14) - offset과 position  (0) 2022.09.28
[43일] jQuery (13) - 아날로그 시계  (0) 2022.09.27
[43일] jQuery (11) - moment  (0) 2022.09.27
'웹개발 교육/jQuery' 카테고리의 다른 글
  • [44일] jQuery (17) - Ajax
  • [44일] jQuery (15) - 스크롤 이동
  • [44일] jQuery (14) - offset과 position
  • [43일] jQuery (13) - 아날로그 시계
ewok
ewok
기록장ewok 님의 블로그입니다.
ewok
기록장
ewok
전체
오늘
어제
  • 분류 전체보기
    • 웹개발 교육
      • HTML
      • CSS
      • JavaScript
      • Database
      • Java
      • jQuery
      • Ajax
      • Bootstrap
      • jsp
      • Spring
      • MyBatis
      • 프로젝트
    • JAVA
    • SpringBoot
      • 기초
      • AWS
      • 개인프로젝트
    • Spring Security
    • JPA
    • 테스트코드
    • Error
    • CS
      • 컴퓨터 구조
      • 이산수학
    • 알고리즘
      • 정리
      • Java
    • SQL
    • 자격증
      • SQLD
      • 정보처리기사
    • Git

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

  • GIT
  • merge commit
  • sqld 합격
  • git bash
  • org.springframework.beans.factory.UnsatisfiedDependencyException
  • branch
  • 브랜치
  • this
  • sqld 자격증
  • SQLD
  • 생성자
  • 버전 관리
  • 노랭이
  • base
  • org.hibernate.tool.schema.spi.CommandAcceptanceException

최근 댓글

최근 글

hELLO · Designed By 정상우.
ewok
[44일] jQuery (16) - Ajax
상단으로

티스토리툴바

단축키

내 블로그

내 블로그 - 관리자 홈 전환
Q
Q
새 글 쓰기
W
W

블로그 게시글

글 수정 (권한 있는 경우)
E
E
댓글 영역으로 이동
C
C

모든 영역

이 페이지의 URL 복사
S
S
맨 위로 이동
T
T
티스토리 홈 이동
H
H
단축키 안내
Shift + /
⇧ + /

* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.