소스 검색

Listing 6.10: $.get() with a query.

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

+ 9 - 1
Chapter 6/06.js

@@ -42,7 +42,7 @@ $(document).ready(function () {
     event.preventDefault();
     $.get('d.xml', function (data) {
       $('#dictionary').empty();
-      $(data).find('entry:has(quote[author])').each (function () {
+      $(data).find('entry').each(function() {
         var $entry = $(this);
         var html = '<div class="entry">';
         html += '<h3 class="term">' + $entry.attr('term');
@@ -70,4 +70,12 @@ $(document).ready(function () {
       });
     });
   });
+
+  $('#letter-e a').click(function (event) {
+    event.preventDefault();
+    var requestData = { term: $(this).text() };
+    $.get('e.php', requestData, function (data) {
+      $('#dictionary').html(data);
+    });
+  });
 });