一、命名
a —— asynchronous異步
ja —— javascript
x —— xml
二、get/post請求
| $.get/post(url,data,fn,type) | 獲取url接口提供的數(shù)據(jù) |
|---|---|
| url | 請求地址(字符串) |
| data | 參數(shù)(對象) |
| fn | 回調(diào)函數(shù),請求結(jié)束后,會(huì)自動(dòng)調(diào)用這個(gè)函數(shù);這個(gè)函數(shù)的參數(shù)就是請求結(jié)果 |
| type | 返回?cái)?shù)據(jù)類型(字符串),如: json,html,text... |
三、ajax
$.ajax({
type:"get/post",
url:"請求地址",
data:{參數(shù)對象},
async:true, - 是否異步
success:function(result - 請求結(jié)果){
} - 回調(diào)函數(shù)
});