瀏覽代碼

Listing 6.4: getJson() callback.

Frederic G. MARAND 9 年之前
父節點
當前提交
57216c406d
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      Chapter 6/06.js

+ 3 - 2
Chapter 6/06.js

@@ -4,11 +4,12 @@ $(document).ready(function () {
   $('#letter-a a').click(function (event) {
     event.preventDefault();
     $('#dictionary').load('a.html');
-    alert('Loaded');
   });
 
   $('#letter-b a').click(function (event) {
     event.preventDefault();
-    $.getJSON('b.json');
+    $.getJSON('b.json', function (data) {
+      console.log(data);
+    });
   });
 });