소스 검색

Listing 6.21. Replacing $(foo).load() by $.ajax().

Frederic G. MARAND 9 년 전
부모
커밋
ccb09fb54f
1개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 5 2
      Chapter 6/06.js

+ 5 - 2
Chapter 6/06.js

@@ -3,8 +3,11 @@ $(document).ready(function () {
 
   $('#letter-a a').click(function (event) {
     event.preventDefault();
-    $('#dictionary').hide().load('a.html', function () {
-      $(this).fadeIn();
+    $.ajax({
+      url: 'a.html',
+      success: function (data) {
+        $('#dictionary').html(data);
+      }
     });
   });