Pārlūkot izejas kodu

Listing 6.13: $.get() with a specific form element.

Frederic G. MARAND 9 gadi atpakaļ
vecāks
revīzija
e0eaf4d473
1 mainītis faili ar 8 papildinājumiem un 0 dzēšanām
  1. 8 0
      Chapter 6/06.js

+ 8 - 0
Chapter 6/06.js

@@ -76,4 +76,12 @@ $(document).ready(function () {
     var requestData = { term: $(this).text() };
     $('#dictionary').load('e.php', requestData);
   });
+
+  $('#letter-f form').submit(function (event) {
+    event.preventDefault();
+    $.get('f.php', { 'term': $('input[name="term"]').val() }, function(data) {
+      $('#dictionary').html(data);
+    });
+  });
 });
+