Selaa lähdekoodia

Listing 6.14: $.get() with a complete form using serialize().

Frederic G. MARAND 9 vuotta sitten
vanhempi
sitoutus
2370782d88
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 2 2
      Chapter 6/06.js

+ 2 - 2
Chapter 6/06.js

@@ -79,9 +79,9 @@ $(document).ready(function () {
 
   $('#letter-f form').submit(function (event) {
     event.preventDefault();
-    $.get('f.php', { 'term': $('input[name="term"]').val() }, function(data) {
+    var formValues = $(this).serialize();
+    $.get('f.php', formValues, function(data) {
       $('#dictionary').html(data);
     });
   });
 });
-