浏览代码

Listing 6.22. Configuring $.ajax() with $.ajaxSetup().

Frederic G. MARAND 9 年之前
父节点
当前提交
c16cc7ee5a
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      Chapter 6/06.js

+ 8 - 1
Chapter 6/06.js

@@ -3,8 +3,15 @@ $(document).ready(function () {
 
 
   $('#letter-a a').click(function (event) {
   $('#letter-a a').click(function (event) {
     event.preventDefault();
     event.preventDefault();
-    $.ajax({
+
+    $.ajaxSetup({
       url: 'a.html',
       url: 'a.html',
+      type: 'POST',
+      dataType: 'html'
+    });
+
+    $.ajax({
+      type: 'GET',
       success: function (data) {
       success: function (data) {
         $('#dictionary').html(data);
         $('#dictionary').html(data);
       }
       }