2017-04-21 88 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中改名爲方法

相關問題