2017-04-21 90 views
9

HI我都用了我的经验 事情,我在想方法和类型都是POSTGET方法。什么是AJAX类型和方法之间的差异

但似乎他们不相似。

如果我使用type这是工作我是serializeing表单数据..

如果我写method它不工作就可以谁能解释一下什么是它们之间的差异..?

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

帮助被占用。

回答

6

来自: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中改名为方法

相关问题