【问题标题】:What is the Diff between type and method in ajaxajax中类型和方法的区别是什么
【发布时间】:2017-09-18 11:36:35
【问题描述】:

您好,根据我的经验,我已经使用了这两种东西 我在想方法和类型都是 POSTGET 方法。

但看起来他们并不相似。?

如果我使用 type 它正在工作,我是 serializeing 表单数据..

如果我写method 它不起作用,谁能解释它们之间的区别是什么......?

$.ajax({
  url: "controller.php",
  type: 'POST',
  method: "POST",
  dataType: "json",
});

帮助被占用。

【问题讨论】:

    标签: javascript jquery ajax post methods


    【解决方案1】:

    类型(默认:'GET') 类型:字符串 方法的别名。如果您使用的是 1.9.0 之前的 jQuery 版本,则应该使用 type。

    http://api.jquery.com/jquery.ajax/

    【讨论】:

      【解决方案2】:

      发件人:http://api.jquery.com/jquery.ajax/

      方法

      The HTTP method to use for the request (e.g. "POST", "GET", "PUT"). (version added: 1.9.0)
      

      类型

      An alias for method. You should use type if you're using versions of jQuery prior to 1.9.0.
      

      【讨论】:

        【解决方案3】:

        两者都是一样的,在新版本的jQuery中,类型重命名为方法

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2012-02-09
          • 2010-10-02
          • 2010-11-06
          • 2015-04-18
          • 2016-06-28
          • 2018-12-10
          • 1970-01-01
          相关资源
          最近更新 更多