[JQuery] [ajax] 04. ajaxMethod

2017. 8. 28. 13:51·JS/JavaScript
728x90
반응형

04_ajaxMethod.html

<meta charset="utf-8" />
<script src="../lib/jquery.js"></script>
<script>
$(function(){
 // Using the core $.ajax() method
 $.ajax({
     // the URL for the request
     url: "data/ajax.json",
  
     // the data to send (will be converted to a query string)
     data: {
         id: 123
     },
  
     // whether this is a POST or GET request
     type: "GET",
  
     // the type of data we expect back
     dataType : "json",
  
     // code to run if the request succeeds;
     // the response is passed to the function
     success: function( json ) {
         $( "<h1/>" ).text( json.title ).appendTo( "body" );
         $( "<div class=\"content\"/>").html( json.html ).appendTo( "body" );
     },
  
     // code to run if the request fails; the raw request and
     // status codes are passed to the function
     error: function( xhr, status, errorThrown ) {
         alert( "Sorry, there was a problem!" );
         console.log( "Error: " + errorThrown );
         console.log( "Status: " + status );
         console.dir( xhr );
     },
  
     // code to run regardless of success or failure
     complete: function( xhr, status ) {
         alert( "The request is complete!" );
     }
 });
});
</script>
 

728x90
반응형

'JS > JavaScript' 카테고리의 다른 글

[JSP][HTML][timeleaf] Javascript 전역 함수 사용법  (0) 2018.05.04
[JSP] 파일업로드 로딩 화면 샘플 소스 DEMO  (0) 2018.04.02
[JS] 13. Closure  (0) 2017.08.28
[JS] 12. scope  (0) 2017.08.28
[JS] 11. This  (0) 2017.08.28
'JS/JavaScript' 카테고리의 다른 글
  • [JSP][HTML][timeleaf] Javascript 전역 함수 사용법
  • [JSP] 파일업로드 로딩 화면 샘플 소스 DEMO
  • [JS] 13. Closure
  • [JS] 12. scope
밍글링글링
밍글링글링
mingling - 밍글링, 밍글밍글링. 코드와 어우러지다. IT/ 프로그래밍/소스
    반응형
    250x250
  • 밍글링글링
    mingling
    밍글링글링
  • 전체
    오늘
    어제
    • 밍글링글링 (463)
      • Flutter (2)
      • 일상생활 (8)
        • 리뷰 (1)
        • 생활정보 (4)
        • 맛집 (0)
        • 여행 (0)
        • 모든정보 (3)
      • JAVA (126)
        • 개념 (6)
        • 예제 (115)
        • Exception (2)
      • C (1)
        • C (1)
        • C++ (0)
        • C# (0)
      • JS (29)
        • JavaScript (18)
        • JQuery (5)
        • AJax (0)
        • NODE.JS (6)
        • Angular.JS 2.0 (0)
      • WEB (87)
        • HTML (6)
        • CSS (61)
        • JSP (20)
        • JSTL (0)
      • FrameWork (8)
        • Spring (8)
        • BootStrap (0)
        • MyBATIS (0)
        • JUnit (0)
      • 외부 라이브러리 (5)
      • 공유 소스 관리 (5)
        • Git (5)
        • SVN (0)
      • 빅데이터 프로그래밍 (37)
        • Python (37)
        • R Programming (0)
      • DB (7)
        • ORACLE (0)
        • MySql (6)
      • Development Tools (7)
        • StarUML (0)
        • eXERD (0)
        • Eclipse (4)
      • SKILL (6)
        • Migration (0)
        • Security (6)
      • MicroSoft (0)
        • Excel (0)
        • Word (0)
      • Android (0)
      • Server (21)
        • Ubuntu (5)
        • Linux (15)
      • IOS (0)
      • XML (0)
      • 미디어 (0)
      • 공지사항 (3)
      • NETWORK (1)
      • 게임 (4)
        • 피파 (1)
        • 리니지M (0)
        • 배틀그라운드 (1)
        • 듀랑고 (2)
      • 세상 이슈 (6)
      • 일렉트론 (0)
      • 대회 소식 (4)
      • 업무 (2)
      • Express, Vue (6)
      • docker (11)
      • svelte (3)
      • 블록체인 (1)
      • IT (66)
      • Rust (0)
  • 블로그 메뉴

    • 홈
    • 태그
    • 미디어로그
    • 위치로그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    docker
    AI 코딩 에이전트
    ssl 인증서 발급
    Node
    티스토리 자동화
    vue cli
    nginx ssl 설정
    mysql db
    AI 반도체
    자바 for문
    css transition
    java casting
    css tb
    SSL 인증서
    API 설계
    nginx
    Extension Bisect
    Rust lang
    자바 배열
    클론코딩
    css perspective
    spring java
    css table
    VS Code 팁
    자바 exception
    lang rust
    jsp include
    servlet class
    ubuntu
    러스트
    Java Array
    오류
    리눅스 설치
    자바 객체 지향
    svelte
    gitlab 설치
    jsp parameter
    브라우저 자동화
    에디터 팁
    자바 생성자
    React Compiler
    vue 설치
    제미나이
    프런트엔드
    proxy pass
    자바 클래스
    nginx ssl 적용
    css float
    rust linux
    vscode
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.6
밍글링글링
[JQuery] [ajax] 04. ajaxMethod
상단으로

티스토리툴바