Procházet zdrojové kódy

Listing 6.18: non-working click handling of ajax-loaded elements.

Frederic G. MARAND před 9 roky
rodič
revize
b539c9869a
1 změnil soubory, kde provedl 5 přidání a 1 odebrání
  1. 5 1
      Chapter 6/06.js

+ 5 - 1
Chapter 6/06.js

@@ -76,7 +76,7 @@ $(document).ready(function () {
   $('#letter-e a').click(function (event) {
     event.preventDefault();
     var requestData = { term: $(this).text() };
-    $.get('z.php', requestData, function (data) {
+    $.get('e.php', requestData, function(data) {
       $('#dictionary').html(data);
     }).fail(function (jqXHR) {
       $('#dictionary')
@@ -101,4 +101,8 @@ $(document).ready(function () {
   }).ajaxStop(function () {
     $loading.hide();
   });
+
+  $('h3.term').click(function () {
+    $(this).siblings('.definition').slideToggle();
+  });
 });